sunlabs.brazil.util
Class ClockFormat
public
class
ClockFormat
extends Object
This class implements the "strftime" style clock format command.
It decodes the following %X format strings:
- '%%'
- Insert a %.
- '%A'
- Full weekday name (Monday, Tuesday, etc.).
- '%a'
- Abbreviated weekday name (Mon, Tue, etc.).
- '%B'
- Full month name.
- '%C'
- Century (00 - 99).
- '%c'
- Locale specific date and time.
- '%D'
- Date as %m/%d/%y.
- '%d'
- Day of month (01 - 31).
- '%e'
- Day of month (1 - 31), no leading zeros.
- '%H'
- Hour in 24-hour format (00 - 23).
- '%h'
- Abbreviated month name (Jan,Feb,etc.).
- '%I'
- Hour in 12-hour format (01 - 12).
- '%j'
- Day of year (001 - 366).
- '%k'
- Hour in 24-hour format (0 - 23), no leading zeros.
- '%l'
- Hour in 12-hour format (1 - 12), no leading zeros.
- '%M'
- Minute (00 - 59).
- '%m'
- Month number (01 - 12).
- '%n'
- Insert a newline.
- '%p'
- AM/PM indicator.
- '%R'
- Time as %H:%M.
- '%r'
- Time as %I:%M:%S %p.
- '%S'
- Seconds (00 - 59).
- '%s'
- seconds since epoch.
- '%T'
- Time as %H:%M:%S.
- '%t'
- Insert a tab.
- '%U'
- Week of year (01-52), Sunday is first day.
- '%u'
- Weekday number (1 - 7) Sunday = 7.
- '%V'
- ISO 8601 Week Of Year (01 - 53).
- '%W'
- Week of year (01-52), Monday is first day.
- '%w'
- Weekday number (0 - 6) Sunday = 0.
- '%X'
- Locale specific time format.
- '%x'
- Locale specific date format.
- '%Y'
- Year with century (e.g. 1990)
- '%y'
- Year without century (00 - 99).
- '%Z'
- Time zone name.
Method Summary |
static String | format(int clockVal, String format, String zone)
Formats a time value based on seconds into a human readable string.
|
static boolean | haveZone(String zone)
See if a particular timezone is valid |
static void | main(String[] args)
Test main:
ClockFormat format ? |
public static String format(int clockVal, String format, String zone)
Formats a time value based on seconds into a human readable string.
Parameters: clockVal Seconds since the epoch format The strftime style format string. If format is
null, then "%a %b %d %H:%M:%S %Z %Y" is used. zone The time zone abbreviation (e.g. GMT, or PST)
Returns: The formatted string.
public static boolean haveZone(String zone)
See if a particular timezone is valid
public static void main(String[] args)
Test main:
ClockFormat format ?time? ?zone?