本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.getHour()
方法的一些代码示例,展示了XMLGregorianCalendar.getHour()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.getHour()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:getHour
[英]Return hours or DatatypeConstants#FIELD_UNDEFINED. Returns DatatypeConstants#FIELD_UNDEFINED if this field is not defined.
Value constraints for this value are summarized in hour field of date/time field mapping table.
[中]
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR);
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
break;
case 'h':
printNumber(buf,value.getHour(),2);
break;
case 'm':
代码示例来源:origin: robovm/robovm
/**
* <p>Returns a hash code consistent with the definition of the equals method.</p>
*
* @return hash code of this object.
*/
public int hashCode() {
// Following two dates compare to EQUALS since in different timezones.
// 2000-01-15T12:00:00-05:00 == 2000-01-15T13:00:00-04:00
//
// Must ensure both instances generate same hashcode by normalizing
// this to UTC timezone.
int timezone = getTimezone();
if (timezone == DatatypeConstants.FIELD_UNDEFINED) {
timezone = 0;
}
XMLGregorianCalendar gc = this;
if (timezone != 0) {
gc = this.normalize();
}
return gc.getYear()
+ gc.getMonth()
+ gc.getDay()
+ gc.getHour()
+ gc.getMinute()
+ gc.getSecond();
}
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR);
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
break;
case 'h':
printNumber(buf,value.getHour(),2);
break;
case 'm':
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public int getHour()
{
return xmlGregorianCalendar.getHour();
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public int getHour()
{
return xmlGregorianCalendar.getHour();
}
代码示例来源:origin: stackoverflow.com
XMLGregorianCalendar xml =
DatatypeFactory.newInstance().newXMLGregorianCalendar("2014-02-05");
System.out.println(xml.toString());
System.out.println(xml.getHour());
System.out.println(xml.getMinute());
System.out.println(xml.getSecond());
代码示例来源:origin: matsim-org/matsim
private double getSeconds(XMLGregorianCalendar daytime) {
double sec = daytime.getHour() * 3600.0;
sec += daytime.getMinute() * 60.0;
sec += daytime.getSecond();
return sec;
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
private XMLGregorianCalendar midnightIfDate(XMLGregorianCalendar clone) {
if (clone == null) {
return null;
}
if (clone.getHour() == DatatypeConstants.FIELD_UNDEFINED) {
clone.setHour(0);
clone.setMinute(0);
clone.setSecond(0);
}
return clone;
}
代码示例来源:origin: goldmansachs/jdmn
private XMLGregorianCalendar midnightIfDate(XMLGregorianCalendar clone) {
if (clone == null) {
return null;
}
if (clone.getHour() == DatatypeConstants.FIELD_UNDEFINED) {
clone.setHour(0);
clone.setMinute(0);
clone.setSecond(0);
}
return clone;
}
代码示例来源:origin: be.fedict.eid-trust-service/eid-trust-service-xkms2-ws-impl
private Date getDate(XMLGregorianCalendar xmlCalendar) {
GregorianCalendar calendar = new GregorianCalendar(
xmlCalendar.getYear(),
xmlCalendar.getMonth() - 1,
xmlCalendar.getDay(), //
xmlCalendar.getHour(), xmlCalendar.getMinute(),
xmlCalendar.getSecond());
calendar.setTimeZone(xmlCalendar.getTimeZone(0));
return calendar.getTime();
}
代码示例来源:origin: palominolabs/sf-api-connector
/**
* Convert an {@link XMLGregorianCalendar} (assumed to be in UTC) into a {@link DateTime}.
*
* @param soapTime the UTC timestamp extracted from the SF soap layer
*
* @return a DateTime object representing the same time as the original soapTime
*/
public static DateTime convertSFTimeToDateTime(XMLGregorianCalendar soapTime) {
return new DateTime(soapTime.getYear(), soapTime.getMonth(), soapTime.getDay(), soapTime.getHour(),
soapTime.getMinute(), soapTime.getSecond(), soapTime.getMillisecond(), DateTimeZone.UTC);
}
}
代码示例来源:origin: rocks.xmpp/xmpp-extensions-common
/**
* Gets the value as date or null.
*
* @return The date or null.
*/
public final OffsetDateTime getAsInstant() {
if (value instanceof XMLGregorianCalendar) {
XMLGregorianCalendar calendar = (XMLGregorianCalendar) value;
return OffsetDateTime.of(calendar.getYear(), calendar.getMonth(), calendar.getDay(), calendar.getHour(), calendar.getMinute(), calendar.getSecond(), 0, ZoneOffset.ofTotalSeconds(calendar.getTimezone() * 60));
}
return null;
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
public static boolean isValidDateTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
long year = calendar.getYear();
BigInteger eonAndYear = calendar.getEonAndYear();
if (eonAndYear != null) {
year = eonAndYear.intValue();
}
return isValidDate(year, calendar.getMonth(), calendar.getDay())
|| isValidDate(year, calendar.getMonth(), calendar.getDay()) && isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
;
}
代码示例来源:origin: apache/cxf
protected boolean equalsTime(XMLGregorianCalendar orig, XMLGregorianCalendar actual) {
boolean result = false;
if ((orig.getHour() == actual.getHour()) && (orig.getMinute() == actual.getMinute())
&& (orig.getSecond() == actual.getSecond()) && (orig.getMillisecond() == actual.getMillisecond())
&& (orig.getTimezone() == actual.getTimezone())) {
result = true;
}
return result;
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
public static boolean isValidTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
return
isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
&& isUndefined(calendar.getYear())
&& isUndefined(calendar.getMonth())
&& isUndefined(calendar.getDay())
;
}
代码示例来源:origin: goldmansachs/jdmn
public static boolean isValidTime(XMLGregorianCalendar calendar) {
if (calendar == null) {
return false;
}
return
isValidTime(calendar.getHour(), calendar.getMinute(), calendar.getSecond())
&& isUndefined(calendar.getYear())
&& isUndefined(calendar.getMonth())
&& isUndefined(calendar.getDay())
;
}
代码示例来源:origin: apache/cxf
protected boolean equalsDateTime(XMLGregorianCalendar orig, XMLGregorianCalendar actual) {
boolean result = false;
if ((orig.getYear() == actual.getYear()) && (orig.getMonth() == actual.getMonth())
&& (orig.getDay() == actual.getDay()) && (orig.getHour() == actual.getHour())
&& (orig.getMinute() == actual.getMinute()) && (orig.getSecond() == actual.getSecond())
&& (orig.getMillisecond() == actual.getMillisecond())) {
result = orig.getTimezone() == actual.getTimezone();
}
return result;
}
代码示例来源:origin: apache/cxf
protected boolean equalsDate(XMLGregorianCalendar orig, XMLGregorianCalendar actual) {
boolean result = false;
if ((orig.getYear() == actual.getYear()) && (orig.getMonth() == actual.getMonth())
&& (orig.getDay() == actual.getDay()) && (actual.getHour() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getMinute() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getSecond() == DatatypeConstants.FIELD_UNDEFINED)
&& (actual.getMillisecond() == DatatypeConstants.FIELD_UNDEFINED)) {
result = orig.getTimezone() == actual.getTimezone();
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!