Class ClockFormat

  extended by sunlabs.brazil.util.ClockFormat (view source)

public class ClockFormat
extends Object

This class implements the "strftime" style clock format command. It decodes the following %X format strings:

Insert a %.
Full weekday name (Monday, Tuesday, etc.).
Abbreviated weekday name (Mon, Tue, etc.).
Full month name.
Century (00 - 99).
Locale specific date and time.
Date as %m/%d/%y.
Day of month (01 - 31).
Day of month (1 - 31), no leading zeros.
Hour in 24-hour format (00 - 23).
Abbreviated month name (Jan,Feb,etc.).
Hour in 12-hour format (01 - 12).
Day of year (001 - 366).
Hour in 24-hour format (0 - 23), no leading zeros.
Hour in 12-hour format (1 - 12), no leading zeros.
Minute (00 - 59).
Month number (01 - 12).
Insert a newline.
AM/PM indicator.
Time as %H:%M.
Time as %I:%M:%S %p.
Seconds (00 - 59).
seconds since epoch.
Time as %H:%M:%S.
Insert a tab.
Week of year (01-52), Sunday is first day.
Weekday number (1 - 7) Sunday = 7.
ISO 8601 Week Of Year (01 - 53).
Week of year (01-52), Monday is first day.
Weekday number (0 - 6) Sunday = 0.
Locale specific time format.
Locale specific date format.
Year with century (e.g. 1990)
Year without century (00 - 99).
Time zone name.

Constructor Summary
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 ?time? ?zone?
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ClockFormat()
Method Detail


public static String format(int clockVal,
                            String format,
                            String zone)
Formats a time value based on seconds into a human readable string.

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)
The formatted string.


public static boolean haveZone(String zone)
See if a particular timezone is valid


public static void main(String[] args)
                 throws Exception
Test main: ClockFormat format ?time? ?zone?


Version Kenai-svn-r24, Generated 08/18/09
Copyright (c) 2001-2009, Sun Microsystems.