/** Get the timezone in XSD tiezone format (e.g. "Z" or "+01:00"). * Assumes the NodeValue is of suitable datatype. */ private static String tzStrFromNV(NodeValue nv) { DateTimeStruct dts = parseAnyDT(nv) ; if ( dts == null ) return "" ; String tzStr = dts.timezone ; if ( tzStr == null ) tzStr = "" ; return tzStr ; }
public static NodeValue dtGetTZ(NodeValue nv) { DateTimeStruct dts = parseAnyDT(nv) ; if ( dts == null ) throw new ExprEvalException("Not a data/time value: " + nv) ; if ( dts.timezone == null ) return NodeValue.nvEmptyString ; return NodeValue.makeString(dts.timezone) ; }
public static NodeValue dtGetTimezone(NodeValue nv) { DateTimeStruct dts = parseAnyDT(nv) ; if ( dts == null || dts.timezone == null ) throw new ExprEvalException("Not a datatype with a timezone: " + nv) ;
public static NodeValue dtGetYear(NodeValue nv) { if ( nv.isDateTime() || nv.isDate() || nv.isGYear() || nv.isGYearMonth() ) { DateTimeStruct dts = parseAnyDT(nv) ; return NodeValue.makeNode(dts.year, XSDDatatype.XSDinteger) ; } throw new ExprEvalException("Not a year datatype") ; }
public static NodeValue dtGetDay(NodeValue nv) { if ( nv.isDateTime() || nv.isDate() || nv.isGMonthDay() || nv.isGDay() ) { DateTimeStruct dts = parseAnyDT(nv) ; return NodeValue.makeNode(dts.day, XSDDatatype.XSDinteger) ; } throw new ExprEvalException("Not a month datatype") ; }
public static NodeValue dtGetMonth(NodeValue nv) { if ( nv.isDateTime() || nv.isDate() || nv.isGYearMonth() || nv.isGMonth() || nv.isGMonthDay() ) { DateTimeStruct dts = parseAnyDT(nv) ; return NodeValue.makeNode(dts.month, XSDDatatype.XSDinteger) ; } throw new ExprEvalException("Not a month datatype") ; }
DateTimeStruct dts = parseAnyDT(nv) ; if ( dts.timezone == null ) dts.timezone = "" ;