Date
Format your dates easily.
Functions
Util.date
Definition
- Name
- Util.date
- Syntax
- String = Util.date( String format [, Mixed timestamp [, Array months] ]);
Description
Format UNIX timestamp or reformat datetime string.
Parameters
- format
-
String date/time format
Options
- timestamp
-
String/Number Optional, unix timestamp in milliseconds since 1970 or valid Date-string. If timestamp is omitted, current time is used.
- months
-
Array Optional, Array with months. If months is omitted, the "F"-character cannot be used.
Return values
String Formatted datetime string.
Examples
u.date("Y-m-d H:i:s");
returns
u.date("Y-m-d", 1331809993423);
returns
u.date("Y-m-d", "Mon Mar 12 2012 12:13:36 GMT+0100 (CET)");
returns
u.date("j/n", "Sat Mar 10 17:58:43 +0000 2012");
returns
u.date("F d, Y", false, ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]);
returns
Dependencies
JavaScript
- String.match
- String.replace
- Array.slice
- Date
Manipulator
Nothing
Files
Main file
- u-date.js
Segment support files
- none
Segment dependencies
- desktop_edge
- u-date.js
- desktop_ie11
- u-date.js
- desktop
- u-date.js
- desktop_ie10
- u-date.js
- desktop_ie9
- u-date.js
- desktop_light
- u-date.js
- tablet
- u-date.js
- tablet_light
- u-date.js
- smartphone
- u-date.js
- mobile
- not tested
- mobile_light
- not tested
- tv
- u-date.js
- seo
- not supported