Class Index | File Index

Classes


Built-In Namespace Date

Field Summary
Field Attributes Field Name and Description
 
A Hash of Arrays, containing localized Days of the Week as strings, using either language or language-country letter location codes (e.g.
 
Hash of Arrays, containing localized Months of the Year as strings, using either language or language-country letter location codes (e.g.
Method Summary
Method Attributes Method Name and Description
 
formatDate(format)
Generate a formatted string from a Date object according to the specified template.
 
Get day of the year
 
Get the number of Days in the current Month, including calculations for February in Leap Years
 
Get the days of the week in the best match for the current browser language settings.
 
Get the months of the year in the best match for the current browser language settings.
 
getWeekOfYear(dowOffset)
Get the week number for this date
 
Determine if current Year is a leap Year
Field Detail
daysOfWeek
A Hash of Arrays, containing localized Days of the Week as strings, using either language or language-country letter location codes (e.g. 'en' or 'en-us')
Defined in: date.js.
//Adding French Candaian days of the week - this will only apply to users with French-Canadian language settings
//Use the language code only to apply to all variations of the language. Country specific variations have precedence.
Date.prototype.daysOfWeek['fr-ca'] = [
	'dimanche',
	'lundi',
	'mardi',
	'mercredi',
	'jeudi',
	'vendredi',
	'samedi'
];

monthsOfYear
Hash of Arrays, containing localized Months of the Year as strings, using either language or language-country letter location codes (e.g. 'en' or 'en-us')
Defined in: date.js.
//Adding Spanish months of the year - this will apply to users with Spanish language settings in any country
//Use the language-country code only to apply to specific variations of the language. Country specific variations have precedence.
Date.prototype.daysOfWeek['es'] = [
	'enero',
	'febrero',
	'marzo',
	'abril',
	'mayo',
	'junio',
	'julio',
	'agosto',
	'septiembre',
	'octubre',
	'noviembre',
	'diciembre'
];
Method Detail
{String} formatDate(format)
Generate a formatted string from a Date object according to the specified template. Supports most of the same characters for date strings as the PHP date function, except date characters to be replaced must have '%' characters wrapping them. The following characters are supported, see http://www.php.net/date for more info
Days: d, D, j, l, N, S, w, z
Week: W
Month: F, m, M, n, t
Year: L, o, Y, y
Time: a, A, g, G, h, H, i, s

Defined in: date.js.
var d = new Date();
var message = d.formatDate('%l%, %F% %d% %Y%'); // "Thursday, January 22 2009"
Parameters:
{String} format
the template for the new String.
Returns:
{String} the template with valid characters replaced with respective values

{Integer} getDayOfYear()
Get day of the year
Defined in: date.js.
Returns:
{Integer} the day of the year

{Number} getDaysInMonth()
Get the number of Days in the current Month, including calculations for February in Leap Years
Defined in: date.js.
Returns:
{Number} the number of Days in the current Month

{String[]} getDaysOfWeek(lang)
Get the days of the week in the best match for the current browser language settings. If the current language/country isn't available, falls back to language only, then English as last resort.
Defined in: date.js.
var t = new Date();
var days = t.getDaysOfWeek('fr-ca'); //Attempt to get the days of the week as an Array, in this order: French-Canadian, French, English
Parameters:
{String} lang Optional
try to force the language to use. Can be a language-country code just a language code. If the specified language/country isn't available, falls back to language only, then English
Returns:
{String[]} days of the week in an Array (index starts at 0)
See:
Date#daysOfWeek

{String[]} getMonthsOfYear(lang)
Get the months of the year in the best match for the current browser language settings. If the current language/country isn't available, falls back to language only, then English as last resort.
Defined in: date.js.
var t = new Date();
var months = t.getMonthsOfYear('es-bo'); //Attempt to get the months of the year as an Array, in this order: Bolivian-Spanish, Spanish, English
Parameters:
{String} lang Optional
try to force the language to use. Can be a language-country code just a language code. If the specified language/country isn't available, falls back to language only, then English
Returns:
{String[]} months of the year in an Array (index starts at 0)
See:
Date#monthsOfYear

{Number} getWeekOfYear(dowOffset)
Get the week number for this date
Defined in: date.js.
Author: Nick Baicoianu at MeanFreePath.
Parameters:
{Number} dowOffset Optional, Default: 0
the day of week the week "starts" on for your locale - it can be from 0 to 6. If dowOffset is 1 (Monday), the week returned is the ISO 8601 week number.
Returns:
{Number} the week number for this date.

{Boolean} isLeapYear()
Determine if current Year is a leap Year
Defined in: date.js.
Returns:
{Boolean} true if current Year is a leap year, false if not

Documentation generated by JsDoc Toolkit 2.1.0 on Tue Feb 03 2009 04:12:53 GMT+1100 (EST)