本文整理了Java中javax.xml.datatype.XMLGregorianCalendar.getDay()
方法的一些代码示例,展示了XMLGregorianCalendar.getDay()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLGregorianCalendar.getDay()
方法的具体详情如下:
包路径:javax.xml.datatype.XMLGregorianCalendar
类名称:XMLGregorianCalendar
方法名:getDay
[英]Return day in month or DatatypeConstants#FIELD_UNDEFINED.
Value constraints for this value are summarized in day field of date/time field mapping table.
[中]返回月份中的日期或DatatypeConstants#字段_未定义。
此值的值约束汇总在day field of date/time field mapping table中。
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY);
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
break;
case 'D':
printNumber(buf,value.getDay(),2);
break;
case 'h':
代码示例来源: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.getDay() == DatatypeConstants.FIELD_UNDEFINED){
buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY);
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
break;
case 'D':
printNumber(buf,value.getDay(),2);
break;
case 'h':
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.eclipse.emf.ecore
@Override
public int getDay()
{
return xmlGregorianCalendar.getDay();
}
代码示例来源:origin: org.eclipse.emf/org.eclipse.emf.ecore
@Override
public int getDay()
{
return xmlGregorianCalendar.getDay();
}
代码示例来源:origin: com.goldmansachs.jdmn/jdmn-core
public BigDecimal day(XMLGregorianCalendar date) {
if (date == null) {
return null;
}
try {
return BigDecimal.valueOf(date.getDay());
} catch (Exception e) {
String message = String.format("day(%s)", date);
logError(message, e);
return null;
}
}
代码示例来源:origin: goldmansachs/jdmn
public BigDecimal day(XMLGregorianCalendar date) {
if (date == null) {
return null;
}
try {
return BigDecimal.valueOf(date.getDay());
} catch (Exception e) {
String message = String.format("day(%s)", date);
logError(message, e);
return null;
}
}
代码示例来源:origin: org.openrdf.mulgara/mulgara-query
public static Date parseLexicalForm(String date) {
XMLGregorianCalendar xgc = factory.newXMLGregorianCalendar(date);
int offset = TimeZone.getDefault().getOffset(xgc.toGregorianCalendar().getTimeInMillis());
xgc.setTimezone(offset / 60000);
GregorianCalendar gc = new GregorianCalendar(0, 0, 0);
gc.setTime(xgc.toGregorianCalendar().getTime());
gc.set(GregorianCalendar.DATE, xgc.getDay());
return gc.getTime();
}
}
代码示例来源:origin: ORCID/ORCID-Source
private static Date getCreatedDate(XMLGregorianCalendar calendar) {
if (calendar != null) {
int year = calendar.getYear();
int month = calendar.getMonth();
int day = calendar.getDay();
return Date.valueOf(FuzzyDate.valueOf(year, month, day));
}
return null;
}
代码示例来源:origin: apache/marmotta
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源:origin: apache/marmotta
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源:origin: org.apache.marmotta/ldpath-backend-sesame
@Override
public Date dateValue(Value node) {
try {
XMLGregorianCalendar cal = ((Literal)node).calendarValue();
return new GregorianCalendar(cal.getYear(), cal.getMonth(), cal.getDay()).getTime();
} catch (ClassCastException e) {
throw new IllegalArgumentException("Value "+node.stringValue()+" is not a literal" +
"but of type "+debugType(node));
}
}
代码示例来源: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: 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: 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: 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;
}
代码示例来源: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;
}
内容来源于网络,如有侵权,请联系作者删除!