NoGray JavaScript Library / Date

ConfigurationCoreFunctionArrayStringNumberMathDateclone() days_in_month() is_leap_year() from_string(str) from_object(obj) print(format, language) get_week_in_year() get_day_in_year() get_hour_in_year() get_minute_in_year() get_second_in_year() get_millisecond_in_year() get_week_since(date) get_day_since(date) get_hour_since(date) get_minute_since(date) get_second_since(date) get_millisecond_since(date) time_difference(date) to_swatch_internet_time() from_swatch_internet_time(beat) to_query() to_json() EventsColorAnimationAnimation EasingElementInnerHTML EventsXHRAssetsValidateFilterPluginComponentButton

We thrive on your donations!

Twitter

Latest News

Partners

... API Date Date.print(format, language)

Date.print(format, language)

Returns a formatted date string similar to PHP date function. Please visit http://us.php.net/manual/en/function.date.php for more details on the possible values. The only exception is the Y and o will return the same value

Parameters:

format required:
The format of the outputted date string. Possible values:

language optional:
String that represent the language file. It defaults to the configuration language value (en).

How to use:

var dt = new Date(2009, 1, 14, 0, 0, 0, 0);

alert(dt.print('c'));      // alerts 2009-02-14T00:00:00+08:00
alert(dt.print('r'));      // alerts Sat, 14 Feb 2009 00:00:00 +0800
alert(dt.print('Y/m/d'));  // alerts 2009/02/14

Demo:

Enter date: