| java.lang.Object org.griphyn.common.util.Currently
Currently | public class Currently (Code) | | Create a common interface to handle obtaining string timestamps.
The difficult part is to allow for an ISO 8601 date formatting.
author: Jens-S. Vöckler author: Yong Zhao version: $Revision: 50 $ See Also: java.util.Date See Also: java.text.SimpleDateFormat |
Constructor Summary | |
public | Currently() Default ctor: Create a new instance with a default formatting
string for timestamps. | public | Currently(String formatString) Ctor: Create a new instance with a formatting string for time stamps. | public | Currently(SimpleDateFormat format) Ctor: Create a new instance with a formatting string for time stamps. |
Method Summary | |
public SimpleDateFormat | getDateFormat() Accessor: Obtains the default timestamp format for all queues. | public static String | iso8601(boolean zuluTime) Ignores any internal date format, and tries to show a complete
date/timp stamp of the current time in extended ISO 8601 format.
UTC time (Zulu time) or a local timezone will be used. | public static String | iso8601(boolean zuluTime, boolean extendedFormat, boolean withMillis, Date now) Ignores any internal date format, and tries to show a complete
date/timp stamp in extended ISO 8601 format. | public String | now() Obtains the current time as formatted string according to
the format option. | public String | now(Date then) Obtains the current time as formatted string according to
the format option.
Parameters: then - is a timestamp expressed as Date. | public static Date | parse(String stamp) Parses one of the ISO 8601 that it produces. | public void | setDateFormat(SimpleDateFormat format) Accessor: Sets the default timestamp format for all queues. | public void | setDateFormat(String format) Accessor: Sets the default timestamp format for all queues. |
DEFAULT_FORMAT | final public static String DEFAULT_FORMAT(Code) | | Default time format, which is compact and has a timezone
|
Currently | public Currently()(Code) | | Default ctor: Create a new instance with a default formatting
string for timestamps.
|
Currently | public Currently(SimpleDateFormat format)(Code) | | Ctor: Create a new instance with a formatting string for time stamps.
Parameters: format - is a description of the simple date format to use. |
iso8601 | public static String iso8601(boolean zuluTime)(Code) | | Ignores any internal date format, and tries to show a complete
date/timp stamp of the current time in extended ISO 8601 format.
UTC time (Zulu time) or a local timezone will be used. A sample for
UTC output is 2002-04-23T02:49:58Z A sample for local zone
(CDT) is 2002-04-22T21:49:58-05:00
Parameters: zuluTime - returns a UTC formatted stamp, if true. Otherwisethe time will be formatted according to the local zone. an ISO 8601 formatted date and time representation for thecurrent time in extended format without millisecond resolution See Also: Currently.iso8601(boolean,boolean,boolean,Date) |
iso8601 | public static String iso8601(boolean zuluTime, boolean extendedFormat, boolean withMillis, Date now)(Code) | | Ignores any internal date format, and tries to show a complete
date/timp stamp in extended ISO 8601 format. UTC time (Zulu time)
or a local timezone will be used.
zone | format | fraction | example |
local | basic | integral | 20020523T140427-0500 |
UTC | basic | integral | 20020523190427Z |
local | extd. | integral | 2002-05-23T14:04:27-05:00 |
UTC | extd. | integral | 2002-05-23T19:04:27Z |
local | basic | millis | 20020523T140427.166-0500 |
UTC | basic | millis | 20020523190427.166Z |
local | extd. | millis | 2002-05-23T14:04:27.166-05:00 |
UTC | extd. | millis | 2002-05-23T19:04:27.166Z |
Parameters: zuluTime - returns a UTC formatted stamp, if true. Otherwisethe time will be formatted according to the local zone. Local timeshould be prefixed with the 'T'. Parameters: extendedFormat - will use the extended ISO 8601 format whichseparates the different timestamp items. If false, the basicformat will be used. In UTC and basic format, the 'T' separatorwill be omitted. Parameters: withMillis - will put the millisecond extension into the timestamp.If false, the time will be without millisecond fraction. The separatoris taken from java.text.DecimalFormatSymbols.getMinusSign, which usually is a period or a comma. Parameters: now - is a time stamp as Date. an ISO 8601 formatted date and time representation forthe given point in time. |
now | public String now()(Code) | | Obtains the current time as formatted string according to
the format option.
the current time as formatted string. See Also: Currently.now(Date) |
now | public String now(Date then)(Code) | | Obtains the current time as formatted string according to
the format option.
Parameters: then - is a timestamp expressed as Date. the current time as formatted string. See Also: Currently.now() |
parse | public static Date parse(String stamp)(Code) | | Parses one of the ISO 8601 that it produces. Note, it will not
parse the full range of ISO timestamps.
Parameters: stamp - is the textual timestamp representation. a time or null , if unparsable. |
|
|