45,21 → 45,21 |
public interface DateService { |
|
public static final String SERVICE_NAME = "DateService"; |
public static final String OPERATION_GETDATE = "getDate"; |
public static final String OPERATION_GETTIMESTAMP = "getTimestamp"; |
public static final String OPERATION_GETINTIMEZONE = "getInTimezone"; |
public static final String OPERATION_FORMATDATE = "formatDate"; |
public static final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced"; |
public static final String OPERATION_PARSEDATE = "parseDate"; |
public static final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced"; |
public static final String OPERATION_DATETIMEDIFF = "dateTimeDiff"; |
public static final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2"; |
public static final String OPERATION_DATEADD = "dateAdd"; |
final String OPERATION_GETDATE = "getDate"; |
final String OPERATION_GETTIMESTAMP = "getTimestamp"; |
final String OPERATION_GETINTIMEZONE = "getInTimezone"; |
final String OPERATION_FORMATDATE = "formatDate"; |
final String OPERATION_FORMATDATEADVANCED = "formatDateAdvanced"; |
final String OPERATION_PARSEDATE = "parseDate"; |
final String OPERATION_PARSEDATEADVANCED = "parseDateAdvanced"; |
final String OPERATION_DATETIMEDIFF = "dateTimeDiff"; |
final String OPERATION_DATETIMEDIFF2 = "dateTimeDiff2"; |
final String OPERATION_DATEADD = "dateAdd"; |
|
public static final String PARAM_TIMEZONE = "timezone"; |
public static final String PARAM_DATETIME = "datetime"; |
public static final String PARAM_FORMAT = "format"; |
public static final String PARAM_UNIT = "unit"; |
final String PARAM_TIMEZONE = "timezone"; |
final String PARAM_DATETIME = "datetime"; |
final String PARAM_FORMAT = "format"; |
final String PARAM_UNIT = "unit"; |
|
/** |
* Get current date and time. |
97,8 → 97,10 |
@WebParam(name=PARAM_TIMEZONE) @XmlElement(required=true) String timezone) throws XServicesFault; |
|
/** |
* @param cal |
* @param format |
* Formats a date with pre-defined patterns. |
* |
* @param cal date time to be formatted |
* @param format Pattern to be used for date formating |
* @return formatted date/time string |
* @throws XServicesFault |
*/ |
107,6 → 109,36 |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, |
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) DateFormatType format) throws XServicesFault; |
|
/** |
* Formats a date with a free form pattern. |
* Uses SimpleDateFormat patterns |
* The following pattern letters are defined (all other characters from 'A' to 'Z' and from 'a' to 'z' are reserved): |
|
Letter Date or Time Component Presentation Examples |
G Era designator Text AD |
y Year Year 1996; 96 |
M Month in year Month July; Jul; 07 |
w Week in year Number 27 |
W Week in month Number 2 |
D Day in year Number 189 |
d Day in month Number 10 |
F Day of week in month Number 2 |
E Day in week Text Tuesday; Tue |
a Am/pm marker Text PM |
H Hour in day (0-23) Number 0 |
k Hour in day (1-24) Number 24 |
K Hour in am/pm (0-11) Number 0 |
h Hour in am/pm (1-12) Number 12 |
m Minute in hour Number 30 |
s Second in minute Number 55 |
S Millisecond Number 978 |
z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 |
Z Time zone RFC 822 time zone -0800 |
* @param cal Date time to be formatted |
* @param format Format string |
* @return Date time formatted according to format string |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_FORMATDATEADVANCED) |
public abstract String formatDateAdvanced( |
@WebParam(name=PARAM_DATETIME) @XmlElement(required=true) GregorianCalendar cal, |
124,6 → 156,13 |
@WebParam(name=PARAM_FORMAT) @XmlElement(required=true) String format, |
@WebParam(name=PARAM_TIMEZONE) String timezone) throws XServicesFault; |
|
/** |
* Calculate elapsed time between two dates. |
* @param fromCal First date. |
* @param toCal Second date. |
* @return Elapsed time in milliseconds |
* @throws XServicesFault |
*/ |
@WebMethod(operationName=OPERATION_DATETIMEDIFF) |
public abstract BigInteger dateTimeDiff( |
@WebParam(name="fromDateTime") @XmlElement(required=true) GregorianCalendar fromCal, |
147,12 → 186,14 |
@WebParam(name="PARAM_UNIT") DateTimeUnits unit) throws XServicesFault; |
|
/** |
* Add or substract a time span from a date. |
* Add or subtract a time span from a date. |
* |
* @param cal |
* @param unit |
* @param cal The initial date. |
* @param value The amount to add. |
* @param unit The unit the amount is defined in. |
* @return New date and time. |
* @throws XServicesFault |
* |
*/ |
@WebMethod(operationName=OPERATION_DATEADD) |
@WSDLDocumentation(value="Add or substract a time span from a date.") |