| java.lang.Object de.anomic.server.serverDate
serverDate | final public class serverDate (Code) | | |
Method Summary | |
public static long | UTCDiff() | public static long | UTCDiff(String diffString) | public static String | UTCDiffString() | public static long | correctedUTCTime() | public static String | formatISO8601(Date date) Creates a String representation of a Date using the format defined
in ISO8601/W3C datetime
The result will be in UTC/GMT, e.g. | public static String | formatInterval(long millis) | public static String | formatShortDay() Note: The short day format doesn't include any timezone information. | public static String | formatShortDay(Date date) | public static String | formatShortDay(Date date, TimeZone tz) This should only be used, if you need a short date String that needs to be aligned to
a special timezone other than GMT/UTC. | public static String | formatShortSecond() Returns the current date in short second format which is a fixed width (14 chars)
String including the date and the time like "20071218233510". | public static String | formatShortSecond(Date date) Identical to
serverDate.formatShortDay(Date) , but for short second format. | public static String | formatShortSecond(Date date, TimeZone tz) Identical to
serverDate.formatShortDay(Date,TimeZone) , but for short second format. | public static void | main(String[] args) | public static Date | parseHTTPDate(String s) Parse a HTTP string representation of a date into a Date instance.
Parameters: s - The date String to parse. | public static Date | parseISO8601(String s) Parse dates as defined in
.
This format (also specified in ISO8601) allows different "precisions".
The following lower precision versions for the complete date
"2007-12-19T10:20:30.567+0300" are allowed:
"2007"
"2007-12"
"2007-12-19"
"2007-12-19T10:20+0300
"2007-12-19T10:20:30+0300
"2007-12-19T10:20:30.567+0300
Additionally a timezone offset of "+0000" can be substituted as "Z".
Parsing is done in a fuzzy way. | public static Date | parseShortDay(String timeString) Parse a String representation of a Date in short day format assuming the date
is aligned to the GMT/UTC timezone. | public static Date | parseShortSecond(String timeString) Like
serverDate.parseShortDay(String) , but for the "short second" format which is short date
plus a 6 digit day time value, like "20071218233510". | public static Date | parseShortSecond(String remoteTimeString, String remoteUTCOffset) Like
serverDate.parseShortSecond(String) using additional timezone information provided in an
offset String, like "+0100" for CET. | public static long | remainingTime(long start, long due, long minimum) | public String | toShortString(boolean millis) | public String | toString() |
FORMATS_HTTP | public static SimpleDateFormat[] FORMATS_HTTP(Code) | | RFC 2616 requires that HTTP clients are able to parse all 3 different
formats. All times MUST be in GMT/UTC, but ...
|
FORMAT_ISO8601 | final public static SimpleDateFormat FORMAT_ISO8601(Code) | | Date formatter/non-sloppy parser for W3C datetime (ISO8601) in GMT/UTC
|
FORMAT_RFC1123 | final public static SimpleDateFormat FORMAT_RFC1123(Code) | | Date formatter/parser for standard compliant HTTP header dates (RFC 1123)
|
FORMAT_SHORT_DAY | final public static SimpleDateFormat FORMAT_SHORT_DAY(Code) | | Date formatter/parser for minimal yyyyMMdd pattern
|
FORMAT_SHORT_MILSEC | final public static SimpleDateFormat FORMAT_SHORT_MILSEC(Code) | | Date formatter/parser for minimal yyyyMMddHHmmssSSS pattern
|
FORMAT_SHORT_SECOND | final public static SimpleDateFormat FORMAT_SHORT_SECOND(Code) | | Date formatter/parser for minimal yyyyMMddHHmmss pattern
|
PATTERN_ANSIC | final public static String PATTERN_ANSIC(Code) | | date pattern used in older HTTP implementations
|
PATTERN_ISO8601 | final public static String PATTERN_ISO8601(Code) | | pattern for a W3C datetime variant of a non-localized ISO8601 date
|
PATTERN_RFC1036 | final public static String PATTERN_RFC1036(Code) | | date pattern used in older HTTP implementations
|
PATTERN_RFC1123 | final public static String PATTERN_RFC1123(Code) | | default HTTP 1.1 header date format pattern
|
PATTERN_SHORT_DAY | final public static String PATTERN_SHORT_DAY(Code) | | minimal date format without time information (fixed width: 8)
|
PATTERN_SHORT_MILSEC | final public static String PATTERN_SHORT_MILSEC(Code) | | minimal date format including milliseconds (fixed width: 17)
|
PATTERN_SHORT_SECOND | final public static String PATTERN_SHORT_SECOND(Code) | | minimal date format (fixed width: 14)
|
dayMillis | final public static long dayMillis(Code) | | |
dimleap | final public static int[] dimleap(Code) | | |
dimnormal | final public static int[] dimnormal(Code) | | |
hourMillis | final public static long hourMillis(Code) | | |
januarynormalfebruaryleapfebruarymarchaprilmayjunejulyaugustseptemberoctobernovemberdecember | final public static int januarynormalfebruaryleapfebruarymarchaprilmayjunejulyaugustseptemberoctobernovemberdecember(Code) | | |
leapyearMillis | final public static long leapyearMillis(Code) | | |
minuteMillis | final public static long minuteMillis(Code) | | |
normalyearMillis | final public static long normalyearMillis(Code) | | |
secondMillis | final public static long secondMillis(Code) | | |
serverDate | public serverDate()(Code) | | |
serverDate | public serverDate(long utime)(Code) | | |
UTCDiff | public static long UTCDiff()(Code) | | |
correctedUTCTime | public static long correctedUTCTime()(Code) | | |
formatISO8601 | public static String formatISO8601(Date date)(Code) | | Creates a String representation of a Date using the format defined
in ISO8601/W3C datetime
The result will be in UTC/GMT, e.g. "2007-12-19T10:20:30Z".
Parameters: date - The Date instance to transform. A fixed width (20 chars) ISO8601 date String. |
formatInterval | public static String formatInterval(long millis)(Code) | | Format a time inteval in milliseconds into a String of the form
X 'day'['s'] HH':'mm
|
formatShortDay | public static String formatShortDay()(Code) | | Note: The short day format doesn't include any timezone information. This method
transforms the date into the GMT/UTC timezone. Example: If the local system time is,
2007-12-18 01:15:00 +0200, then the resulting String will be "2007-12-17".
In case you need a format with a timezon offset, use
serverDate.formatShortDay(TimeZone) a String representation of the current system date in GMT using theshort day format, e.g. "20071218". |
formatShortDay | public static String formatShortDay(Date date, TimeZone tz)(Code) | | This should only be used, if you need a short date String that needs to be aligned to
a special timezone other than GMT/UTC. Be aware that a receiver won't be able to
recreate the original Date without additional timezone information.
See Also: serverDate.formatShortDay() Parameters: date - the Date to transform Parameters: tz - a TimeZone the resulting date String should be aligned to. |
formatShortSecond | public static String formatShortSecond()(Code) | | Returns the current date in short second format which is a fixed width (14 chars)
String including the date and the time like "20071218233510". The result is in GMT/UTC.
See Also: serverDate.formatShortDay() |
parseHTTPDate | public static Date parseHTTPDate(String s)(Code) | | Parse a HTTP string representation of a date into a Date instance.
Parameters: s - The date String to parse. The Date instance if successful, null otherwise. |
parseISO8601 | public static Date parseISO8601(String s) throws ParseException(Code) | | Parse dates as defined in
.
This format (also specified in ISO8601) allows different "precisions".
The following lower precision versions for the complete date
"2007-12-19T10:20:30.567+0300" are allowed:
"2007"
"2007-12"
"2007-12-19"
"2007-12-19T10:20+0300
"2007-12-19T10:20:30+0300
"2007-12-19T10:20:30.567+0300
Additionally a timezone offset of "+0000" can be substituted as "Z".
Parsing is done in a fuzzy way. If there is an illegal character somewhere in
the String, the date parsed so far will be returned, e.g. the input
"2007-12-19FOO" would return a date that represents "2007-12-19".
Parameters: s - throws: ParseException - |
parseShortDay | public static Date parseShortDay(String timeString) throws ParseException(Code) | | Parse a String representation of a Date in short day format assuming the date
is aligned to the GMT/UTC timezone. An example for such a date string is "20071218".
See Also: serverDate.formatShortDay() throws: ParseException - The exception is thrown if an error occured during while parsingthe String. |
remainingTime | public static long remainingTime(long start, long due, long minimum)(Code) | | |
toShortString | public String toShortString(boolean millis)(Code) | | |
|
|