Just a very simple class to hold some functions for formating a Flash Date object.
No need to create instances of the class - just use the static methods it provides...
This code and documentation is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.0. http://creativecommons.org/licenses/by-nc-sa/2.0/
0.1.0
Kelvin Luck < kelvin at kelvinluck dot com >
$Id: DateFormat.as 37 2006-05-10 19:29:32Z kluck $
| com. kelvinluck. util. DateFormat | Just a very simple class to hold some functions for formating a Flash Date object. |
| DateFormat | Private constructor to prevent you creating instances of this class |
| dateToIso | Static function which converts a given Date object into an ISO / MySQL Date Stamp format (e.g. |
| isoToDate | Static function which converts a given ISO / MySQL Date Stamp Format String (e.g. |
| secsToDate | Static function which converts a number of seconds into a Date object. |
| _zeroPad | Simple function to make sure a number is the right amount of characters long - used internally by dateToIso. |
private function DateFormat()
Private constructor to prevent you creating instances of this class
public static function dateToIso( date: Date, hideTime: Boolean ):String
Static function which converts a given Date object into an ISO / MySQL Date Stamp format (e.g. “yyyy-mm-dd hh:mm:ss”)
| date | The Date to convert |
| hideTime | Whether to include the time in the generated date - defaults to true |
The ISO / MySQL Date Stamp Format String.
public static function isoToDate( dateStr: String ):Date
Static function which converts a given ISO / MySQL Date Stamp Format String (e.g. “yyyy-mm-dd hh:mm:ss”) into a Date object
| dateStr | The ISO / MySQL Date Stamp Format String |
The converted Date object.
public static function secsToDate( secs ):Date
Static function which converts a number of seconds into a Date object.
| secs | The number of seconds since 1970. Purposefully not strongly typed as the whole point of this very simple function is to save on typing in the cases you may need it. |
The converted Date object.
private static function _zeroPad( value: Number ):String
Simple function to make sure a number is the right amount of characters long - used internally by dateToIso.
| value | The number you want to zero pad. |
Maybe add a second parameter which is how many zeros you want to pad it with?
Private constructor to prevent you creating instances of this class
private function DateFormat()
Static function which converts a given Date object into an ISO / MySQL Date Stamp format (e.g.
public static function dateToIso( date: Date, hideTime: Boolean ):String
Static function which converts a given ISO / MySQL Date Stamp Format String (e.g.
public static function isoToDate( dateStr: String ):Date
Static function which converts a number of seconds into a Date object.
public static function secsToDate( secs ):Date
Simple function to make sure a number is the right amount of characters long - used internally by dateToIso.
private static function _zeroPad( value: Number ):String