Packagecom.almirun.common.util
Classpublic class TimeFormatter

A thin OO wrapper for an AS3 version of the C function strftime().



Public Methods
 MethodDefined by
  
formatTime(format:String, date:Date):String
[static] Convert date and time to a string

The formats allowed follow the C-style syntax of strftime().

TimeFormatter
Method detail
formatTime()method
public static function formatTime(format:String, date:Date):String

Convert date and time to a string

The formats allowed follow the C-style syntax of strftime(). See http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html for details. Note: not all formats are currently implemented, I have only done those ones that were easy to implement using the Date object.

Each conversion specification in the format string is represented by a percent character "%" followed by a specific character as per the following:

%a is replaced by the abbreviated weekday name (Mon, Tue, etc)

%A is replaced by the full weekday name.

%b is replaced by the abbreviated month name.

%B is replaced by the full month name.

%c is replaced by the default Date.toString() value.

%C is replaced by the century number (the year divided by 100 and truncated to an integer) as a decimal number [00-99].

%d is replaced by the day of the month as a decimal number [01-31].

%D is the same as %d/%m/%y (deviation from standard).

%e is replaced by the day of the month as a decimal number [1-31]; a single digit is preceded by a space.

%e is replaced by the day of the month as a decimal number [1-31]; no leading zero or space character (non-standard addition).

%f gives the ordinal suffix (st, nd, rd, th) appropriate to the day of the month (non-standard addition).

%h is the same as %b.

%H is replaced by the hour (24-hour clock) as a decimal number [00-23].

%I is replaced by the hour (12-hour clock) as a decimal number [1-12].

%j is replaced by the day of the year as a decimal number [001-366].

%m is replaced by the month as a decimal number [01-12].

%M is replaced by the minute as a decimal number [00-59].

%n is replaced by a newline character.

%p is replaced by either a.m. or p.m.

%P is replaced by either am or pm (non-standard addition)

%r is equivalent to %I:%M:%S %p.

%R is replaced by the time in 24 hour notation (%H:%M).

%S is replaced by the second as a decimal number [00-61].

%t is replaced by a tab character.

%T is replaced by the time (%H:%M:%S).

%u is replaced by the weekday as a decimal number [1-7], with 1 representing Monday.

%U is not implemented.

%V is not implemented.

%w is replaced by the weekday as a decimal number [0-6], with 0 representing Sunday.

%W is not implemented.

%x is not implemented.

%X is not implemented.

%y is replaced by the year without century as a decimal number [00-99].

%Y is replaced by the year with century as a decimal number.

%Z is replaced by the timezone name or abbreviation, or by no bytes if no timezone information exists.

%% is replaced by literal %.

Parameters
format:String — The format to use.
 
date:Date — The date to format.

Returns
String