«
jsDate

Class jsDate

Defined in: jsdate.js.

Constructor Summary
new jsDate (arguments) Object with extended date parsing and formatting capabilities.
Field Summary
Method Summary
add(number, unit) Add an arbitrary amount to the currently stored date
clone() Create a new jqplot.date object with the same date
diff(dateObj, unit, allowDecimal) Find the difference between this jsDate and another date.
getAbbrDayName() Get the abbreviated name of the current week day
getAbbrMonthName() Get the abbreviated name of the current month
getAMPM() Get UPPER CASE AM or PM for the current time
getAmPm() Get lower case am or pm for the current time
getCentury() Get the century (19 for 20th Century)
getDate() Implements Date functionality
getDay() Implements Date functionality
getDayOfWeek() Get the Day of week 1 (Monday) thru 7 (Sunday)
getDayOfYear() Get the day of the year
getDayName() Get the name of the current week day
getFullWeekOfYear() Get the week number of the given year, starting with the first Sunday as the first week
getFullYear() Implements Date functionality
getGmtOffset() Get the GMT offset in hours and minutes (e.g.
getHours() Implements Date functionality
getHours12() Get the current hour on a 12-hour scheme
getMilliseconds() Implements Date functionality
getMinutes() Implements Date functionality
getMonth() Implements Date functionality
getMonthName() Get the name of the current month
getMonthNumber() Get the number of the current month, 1-12
getSeconds() Implements Date functionality
getShortYear() Return a proper two-digit year integer
getTime() Implements Date functionality
getTimezoneAbbr() Get the timezone abbreviation
getTimezoneName() Get the browser-reported name for the current timezone (e.g.
getTimezoneOffset() Implements Date functionality
getWeekOfYear() Get the week number of the given year, starting with the first Monday as the first week
getUnix() Get the current date as a Unix timestamp
getYear() Implements Date functionality
next(unit) Return a date one day ahead (or any other unit)
set(arguments) Set the jsDate instance to a new date.
setDate(dayValue) Sets the day of the month for a specified date according to local time.
setFullYear(yearValue, monthValue, dayValue) Sets the full year for a specified date according to local time.
setHours(hoursValue, minutesValue, secondsValue, msValue) Sets the hours for a specified date according to local time.
setMilliseconds(n) Implements Date functionality
setMinutes() Implements Date functionality
setMonth() Implements Date functionality
setSeconds() Implements Date functionality
setTime(n) Implements Date functionality
strftime(formatString) Provide a formatted string representation of this date.
toString() Return a String representation of this jsDate object.
toYmdInt() Convert the current date to an 8-digit integer (%Y%m%d)
strftime(date, formatString, syntax, locale)
daysInMonth(year, month)
Constructor Detail
new jsDate(arguments)

Object with extended date parsing and formatting capabilities. This library borrows many concepts and ideas from the Date Instance Methods by Ken Snyder along with some parts of Ken's actual code.

jsDate is fundamentally a new implementation, however. I takes a different approach by not extending the built-in Date Object, handling date parsing in a more robust manner, allowing for multiple formatting syntaxes and multiple, expandable localization.

Ken's origianl Date Instance Methods can be found at: http://kendsnyder.com/sandbox/date/


									
									
									
										
											
Parameters:
{String | Number | Array | Date Object | Options Object} arguments
Optional arguments, either a parsable date/time string, a JavaScript timestamp, an array of numbers of form [year, month, day, hours, minutes, seconds, milliseconds], a Date object, or an options object of form {syntax: "perl", date:some Date} where all options are optional.
Field Detail
jsDate.config

									
								
									
										
										
										
										
				
								
jsDate.regional

									
								
									
										
										
										
										
				
								
jsDate.formats

									
								
									
										
										
										
										
				
								
Method Detail
add(number, unit) : jsDate
Add an arbitrary amount to the currently stored date

										
									
Parameters:
{Number} number
{String} unit
Returns:
{jsDate}
clone() : jsDate
Create a new jqplot.date object with the same date

										
									
Returns:
{jsDate}
diff(dateObj, unit, allowDecimal) : Number
Find the difference between this jsDate and another date.

										
									
Parameters:
{String| Number| Array| jsDate Object| Date Object} dateObj
{String} unit
{Boolean} allowDecimal
Returns:
{Number} Number of units difference between dates.
getAbbrDayName() : String
Get the abbreviated name of the current week day

										
									
Returns:
{String}
getAbbrMonthName() : String
Get the abbreviated name of the current month

										
									
Returns:
{String}
getAMPM() : String
Get UPPER CASE AM or PM for the current time

										
									
Returns:
{String}
getAmPm() : String
Get lower case am or pm for the current time

										
									
Returns:
{String}
getCentury() : Integer
Get the century (19 for 20th Century)

										
									
Returns:
{Integer} Century (19 for 20th century).
getDate()
Implements Date functionality

										
									
getDay()
Implements Date functionality

										
									
getDayOfWeek() : Integer
Get the Day of week 1 (Monday) thru 7 (Sunday)

										
									
Returns:
{Integer} Day of week 1 (Monday) thru 7 (Sunday)
getDayOfYear() : Integer
Get the day of the year

										
									
Returns:
{Integer} 1 - 366, day of the year
getDayName() : String
Get the name of the current week day

										
									
Returns:
{String}
getFullWeekOfYear() : Integer
Get the week number of the given year, starting with the first Sunday as the first week

										
									
Returns:
{Integer} Week number (13 for the 13th full week of the year).
getFullYear()
Implements Date functionality

										
									
getGmtOffset() : String
Get the GMT offset in hours and minutes (e.g. +06:30)

										
									
Returns:
{String}
getHours()
Implements Date functionality

										
									
getHours12() : Integer
Get the current hour on a 12-hour scheme

										
									
Returns:
{Integer}
getMilliseconds()
Implements Date functionality

										
									
getMinutes()
Implements Date functionality

										
									
getMonth()
Implements Date functionality

										
									
getMonthName() : String
Get the name of the current month

										
									
Returns:
{String}
getMonthNumber() : Integer
Get the number of the current month, 1-12

										
									
Returns:
{Integer}
getSeconds()
Implements Date functionality

										
									
getShortYear() : Integer
Return a proper two-digit year integer

										
									
Returns:
{Integer}
getTime()
Implements Date functionality

										
									
getTimezoneAbbr() : String
Get the timezone abbreviation

										
									
Returns:
{String} Abbreviation for the timezone
getTimezoneName() : String
Get the browser-reported name for the current timezone (e.g. MDT, Mountain Daylight Time)

										
									
Returns:
{String}
getTimezoneOffset()
Implements Date functionality

										
									
getWeekOfYear() : Integer
Get the week number of the given year, starting with the first Monday as the first week

										
									
Returns:
{Integer} Week number (13 for the 13th week of the year).
getUnix() : Integer
Get the current date as a Unix timestamp

										
									
Returns:
{Integer}
getYear()
Implements Date functionality

										
									
next(unit) : jsDate
Return a date one day ahead (or any other unit)

										
									
Parameters:
{String} unit Optional, year | month | day | week | hour | minute | second | millisecond
Returns:
{jsDate}
set(arguments)
Set the jsDate instance to a new date.

										
									
Parameters:
{String | Number | Array | Date Object | jsDate Object | Options Object} arguments Optional arguments, either a parsable date/time string, a JavaScript timestamp, an array of numbers of form [year, month, day, hours, minutes, seconds, milliseconds], a Date object, jsDate Object or an options object of form {syntax: "perl", date:some Date} where all options are optional.
setDate(dayValue)
Sets the day of the month for a specified date according to local time.

										
									
Parameters:
{Integer} dayValue An integer from 1 to 31, representing the day of the month.
setFullYear(yearValue, monthValue, dayValue)
Sets the full year for a specified date according to local time.

										
									
Parameters:
{Integer} yearValue The numeric value of the year, for example, 1995.
{Integer} monthValue Optional, between 0 and 11 representing the months January through December.
{Integer} dayValue Optional, between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.
setHours(hoursValue, minutesValue, secondsValue, msValue)
Sets the hours for a specified date according to local time.

										
									
Parameters:
{Integer} hoursValue An integer between 0 and 23, representing the hour.
{Integer} minutesValue Optional, An integer between 0 and 59, representing the minutes.
{Integer} secondsValue Optional, An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.
{Integer} msValue Optional, A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.
setMilliseconds(n)
Implements Date functionality

										
									
Parameters:
n
setMinutes()
Implements Date functionality

										
									
setMonth()
Implements Date functionality

										
									
setSeconds()
Implements Date functionality

										
									
setTime(n)
Implements Date functionality

										
									
Parameters:
n
strftime(formatString) : String
Provide a formatted string representation of this date.

										
									
Parameters:
{String} formatString A format string. See: jsDate.formats.
Returns:
{String} Date String.
toString() : String
Return a String representation of this jsDate object.

										
									
Returns:
{String} Date string.
toYmdInt() : Integer
Convert the current date to an 8-digit integer (%Y%m%d)

										
									
Returns:
{Integer}
jsDate.strftime(date, formatString, syntax, locale) : String

										
									
Parameters:
{String | Number | Array | jsDate Object | Date Object} date A parsable date string, JavaScript time stamp, Array of form [year, month, day, hours, minutes, seconds, milliseconds], jsDate Object or Date object.
{String} formatString String with embedded date formatting codes. See: jsDate.formats.
{String} syntax Optional syntax to use [default perl].
{String} locale Optional locale to use.
Returns:
{String} Formatted representation of the date.
jsDate.daysInMonth(year, month) : Integer

										
									
Parameters:
{Integer} year Year
{Integer} month Month (1-12)
Returns:
{Integer} Number of days in the month.
©2010 Chris Leonello

Documentation generated using JsDoc Toolkit 2.4.0 on Fri Dec 03 2010 15:36:44 GMT-0500 (EST)