Location Formats
Location | Abbreviation |
---|---|
United States | US |
Canada | CA |
United Kingdom | UK |
Australia | AU |
New Zealand | NZ |
South Africa | ZA |
Mexico | MX |
Spain | ES |
Mexico | MX |
India | IN |
Ireland | IE |
France | FR |
Slovenia | SI |
Bulgaria | BG |
Netherlands | DU |
Danmark | DK |
Indonesia | ID |
Brazil | BR |
Greece | GR |
Date and Time Formats
Format | Example |
---|---|
full_date_fmt | Wednesday, March 18, 2015 |
long_date_fmt | March 18, 2015 |
date_fmt | Mar 18, 2015 |
short_date_fmt | 3/18/2015 |
time_fmt | 10:00 PM |
time_sec_fmt | 10:00:00 PM |
time_zone_fmt | 10:00:00 PM EET |
currency | USD, MXN, EUR |
Variables for custom date/time format
Variable | Description |
---|---|
$WEEKDAY$ | the full day of the week (Monday) |
$WD$ | the short day of the week (Wed) |
$YEAR$ | the full 4-digit year |
$YR$ | the 2-digit year |
$MONTH$ | the full name of the month |
$MNT$ | the abbreviation of the month |
$MN$ | the numeric month (11) |
$0M$ | the zero-padded month (06) |
$D$ | the day of the month (8) |
$0D$ | zero padded day of the month (08) |
$H$, $H12$ | the hour in 12h range |
$H24$ | the hour in 24h range |
$M$ | Minutes (31) |
$S$ | Seconds (55) |
$AMPM$ | the AM/PM suffix |
$AM.PM$ | the A.M/P.M suffix with dots |
$TIMEZONE$ | the full time zone (Pacific Standard Time) |
$TZ$ | Time zone abbreviations (PST) |
$UTC$ | UTC offset of time zone |
Methods
The SK.Util.DateTime is class that provides the following methods in order to use SK Date and Time formating.
Name | Description | Parameters | Returns |
---|---|---|---|
format | Performs date/time formatting using date and time formats or variables. | Mixed (date to be formatted), Mixed (format to use) | String |
formatUTC | Performs date/time formatting in UTC time using date and time formats or variables. | Mixed (date to be formatted), Mixed (format to use) | String |
validate | Whether or not date is in a specific format. | Mixed (date to be validated), Mixed (format for validation) | Boolean |
parseInput | Returns the date into standard date format returned by new Date(). | Mixed (date to be parsed), Mixed (format it is using date and time formats or variables) | Object (Date) |
setDefaultFormat | Usign specific date/time format as default using date and time formats or variables. | Mixed (date to be set as default) | - |
nowUTC | Returns the date and time in UTC time. | - | Object (Date) |
The SK.Util.Currency provides the following methods.
Name | Description | Parameters | Returns |
---|---|---|---|
formatSymbol | Performs currency formatting. | Mixed (the price value to format), String (the currency), String (the position of the symbol according to the price) | String (Formatted price) |
getInfo | Finds currency in a list (needs to be predefined in object) and returns array with information about the currency. | String (currency abbreviation), Object (holding information about currencies) | Array |
The SK.Util.Language method provides the site language. It can have parameter <string< i=""> (holding the language) and it will return it even when different than the site language.</string<>
Examples
// Returns 3/27/2015 SK.Util.DateTime.format( '2015-03-27', 'short_date_fmt' ); // Returns Friday, 27 March SK.Util.DateTime.formatUTC( new Date(), '$WEEKDAY$, $D$ $MONTH$' ); // Returns Tue Mar 27 2001 00:00:00 GMT+0300 (EEST) SK.Util.DateTime.parseInput( 'Friday, 27 March', '$WEEKDAY$, $D$ $MONTH$' ); // Returns false SK.Util.DateTime.validate( 'Friday, 27 March', 'full_date_fmt' ); // Returns undefined and sets the needed format as default SK.Util.DateTime.setDefaultFormat( 'short_date_fmt' ); // Returns the current date and time in UTC time - Fri Mar 27 2015 15:07:26 GMT+0200 (EET) SK.Util.DateTime.nowUTC(); // Returns formatted price EUR200 SK.Util.Currency.formatSymbol('200', 'EUR', 'left'); //Returns site language EN SK.Util.getLanguage(); |