/** * The date:week-in-year function returns the week of the year as a number. If no argument * is given, then the current local date/time, as returned by date:date-time is used as the * default argument. For the purposes of numbering, counting follows ISO 8601: week 1 in a year * is the week containing the first Thursday of the year, with new weeks beginning on a Monday. * The date/time string specified as the argument is a right-truncated string in the format * defined as the lexical representation of xs:dateTime in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. The * permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double weekInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.WEEK_OF_YEAR); }
/** * The date:day-in-year function returns the day of a date in a year * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_YEAR); }
/** * The date:hour-in-day function returns the hour of the day as a number. * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double hourInDay(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, t}; return getNumber(datetime, formats, Calendar.HOUR_OF_DAY); }
/** * The date:minute-in-hour function returns the minute of the hour * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double minuteInHour(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt,t}; return getNumber(datetime, formats, Calendar.MINUTE); }
/** * The date:second-in-minute function returns the second of the minute * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double secondInMinute(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, t}; return getNumber(datetime, formats, Calendar.SECOND); }
/** * The date:day-in-week function returns the day of the week given in a * date as a number. If no argument is given, then the current local date/time, * as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated string * in the format defined as the lexical representation of xs:dateTime in one * of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. The numbering of days of the week starts at 1 for Sunday, 2 for Monday and so on up to 7 for Saturday. */ public static double dayInWeek(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_WEEK); }
/** * The date:day-of-week-in-month function returns the day-of-the-week * in a month of a date as a number (e.g. 3 for the 3rd Tuesday in May). * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated string * in the format defined as the lexical representation of xs:dateTime in one * of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayOfWeekInMonth(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_WEEK_IN_MONTH); }
/** * The date:day-in-month function returns the day of a date as a number. * If no argument is given, then the current local date/time, as returned * by date:date-time is used the default argument. * The date/time string specified as the argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gMonthDay (--MM-DD) * xs:gDay (---DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInMonth(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; String[] formats = {dt, d, gmd, gd}; double day = getNumber(datetime, formats, Calendar.DAY_OF_MONTH); return day; }
/** * The date:month-in-year function returns the month of a date as a number. If no argument * is given, then the current local date/time, as returned by date:date-time is used * as a default argument. * The date/time string specified as the first argument is a left or right-truncated * string in the format defined as the lexical representation of xs:dateTime in one of * the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * xs:gYearMonth (CCYY-MM) * xs:gMonth (--MM--) * xs:gMonthDay (--MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double monthInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d, gym, gm, gmd}; return getNumber(datetime, formats, Calendar.MONTH) + 1; }
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); boolean ad = edz[0].length() == 0; // AD (Common Era -- empty leader) String datetime = edz[1];
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null)
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null)
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null)
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null)
throws ParseException String[] edz = getEraDatetimeZone(timeIn); String time = edz[1]; String zone = edz[2];
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String leader = edz[0]; String datetime = edz[1];
throws ParseException String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null)
/** * The date:minute-in-hour function returns the minute of the hour * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double minuteInHour(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt,t}; return getNumber(datetime, formats, Calendar.MINUTE); }
/** * The date:day-in-year function returns the day of a date in a year * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:date (CCYY-MM-DD) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double dayInYear(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, d}; return getNumber(datetime, formats, Calendar.DAY_OF_YEAR); }
/** * The date:second-in-minute function returns the second of the minute * as a number. If no argument is given, then the current local * date/time, as returned by date:date-time is used the default argument. * The date/time string specified as the argument is a right-truncated * string in the format defined as the lexical representation of xs:dateTime * in one of the formats defined in * <a href="http://www.w3.org/TR/xmlschema-2/">[XML Schema Part 2: Datatypes]</a>. * The permitted formats are as follows: * xs:dateTime (CCYY-MM-DDThh:mm:ss) * xs:time (hh:mm:ss) * If the date/time string is not in one of these formats, then NaN is returned. */ public static double secondInMinute(String datetimeIn) throws ParseException { String[] edz = getEraDatetimeZone(datetimeIn); String datetime = edz[1]; if (datetime == null) return Double.NaN; String[] formats = {dt, t}; return getNumber(datetime, formats, Calendar.SECOND); }