|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--PTDate
A useful wrapper class around Date objects. Also contains static methods for manipulating Dates.
Usage:
var ptd = new PTDate('', new Date(), 'en');
ptd.incrementMonth();
PTDate.get2DigitMinutes(new Date());
Field Summary | |
Date |
date
The underlying Date object |
<static> <final> String |
DEFAULT_LOCALE
The Default locale constant. |
<static> String |
defaultDateFormat
Date format used as default for all new PTDate objects. |
<static> String |
defaultLanguage
Language used as default for all new PTDate objects. |
<static> <final> Number |
FORMAT_DEFAULT
Default date format constant |
<static> <final> Number |
FORMAT_FULL
Full date format constant |
<static> <final> Number |
FORMAT_LONG
Long date format constant |
<static> <final> Number |
FORMAT_MEDIUM
Medium date format constant |
<static> <final> Number |
FORMAT_SHORT
Short date format constant |
<static> <final> Number |
TIME_POLICY_ALLOW_TIMES
Allow times time-policy constant |
<static> <final> Number |
TIME_POLICY_FORBID_TIMES
Forbid times time-policy constant |
<static> <final> Number |
TIME_POLICY_REQUIRE_TIMES
Require times time-policy constant |
<static> <final> Object |
VERSION
|
Constructor Summary | |
PTDate
(datestring,date,language,dateFormat)
PTDate Object constructor |
Method Summary | |
Object
|
clone()
Returns a (by value) copy of this object. |
String
|
format(dateFormat,language)
Generate a custom-formatted string from a PTDate This function uses the same formatting codes as Java date formats. Eg: EEE MMM d HH:mm:ss yyyy yields: Mon Feb 7 08:30:00 2003 |
Number
|
getNumberOfDaysInThisMonth()
Returns the number of days in the month of the internal date object |
Number
|
getTime()
wrapper method for Date.getTime() method |
Boolean
|
hasTime()
Determines whether or not a PTDate object has a specific time associated with the date, or if its specificity is limited to the day level or greater. |
void
|
incrementDay()
Increments the internal date object by one day |
void
|
incrementMonth()
Increments the month of the internal date object |
void
|
incrementWeek()
Increments the internal date object by one week |
<static> String
|
convert2DigitTo4DigitYear(year)
Convert a 2-digit to a 4-digit year, subject to pivot date |
<static> String
|
formatDate(date,dateFormat,language)
Format a Date object |
<static> String
|
get1Digit0To11Hour(date)
Get hour in 1-digit form, range 0 to 11 |
<static> String
|
get1Digit1To12Hour(date)
Get hour in 1-digit form, range 1 to 12 |
<static> String
|
get1Digit1To24Hour(date)
Get hour in 1-digit form, range 1 to 24 |
<static> String
|
get1DigitDayOfMonth(date)
Get date of month in 1-digit form |
<static> String
|
get1DigitMinutes(date)
Get minutes in 1-digit form |
<static> String
|
get1DigitMonth(date)
Get month in 1-digit form |
<static> String
|
get1DigitSeconds(date)
Get seconds in 1-digit form |
<static> String
|
get2Digit0To11Hour(date)
Get hour in 2-digit form, range 0 to 11 |
<static> String
|
get2Digit0To23Hour(date)
Get hour in 2-digit form, range 0 to 23 |
<static> String
|
get2Digit1To12Hour(date)
Get hour in 2-digit form, range 1 to 12 |
<static> String
|
get2Digit1To24Hour(date)
Get hour in 2-digit form, range 1 to 24 |
<static> String
|
get2DigitDayOfMonth(date)
Get date of month in 2-digit form |
<static> String
|
get2DigitMinutes(date)
Get minutes in 2-digit form |
<static> String
|
get2DigitMonth(date)
Get month in 2-digit form |
<static> String
|
get2DigitSeconds(date)
Get seconds in 2-digit form |
<static> String
|
get2DigitYear(date)
get2DigitYear Get year in 2-digit form |
<static> String
|
get3DigitMilliseconds(date)
Get milliseconds in 3-digit form |
<static> String
|
getAMPM(date,language)
Get AM/PM string for date, internationalized |
<static> Number
|
getNumberOfDaysInMonth(date)
Returns the number of days in the month of a given date |
<static> Boolean
|
isLeapYear(year)
Is a given year a leap year? |
<static> String
|
validateAndFormatDate(dateString, outputFormat, locale, alertOnFailure, timePolicy, formatList)
Validate a string to determine if it is a valid date, and if so format it to a desired format |
<static> Boolean
|
validateDate(dateString, locale, alertOnFailure, timePolicy, formatList)
Validate a string to determine if it is a valid date |
Field Detail |
Date date
<static> <final> String DEFAULT_LOCALE
<static> String defaultDateFormat
<static> String defaultLanguage
<static> <final> Number FORMAT_DEFAULT
<static> <final> Number FORMAT_FULL
<static> <final> Number FORMAT_LONG
<static> <final> Number FORMAT_MEDIUM
<static> <final> Number FORMAT_SHORT
<static> <final> Number TIME_POLICY_ALLOW_TIMES
<static> <final> Number TIME_POLICY_FORBID_TIMES
<static> <final> Number TIME_POLICY_REQUIRE_TIMES
<static> <final> Object VERSION
Constructor Detail |
PTDate(datestring,date,language,dateFormat)
datestring
- String containing date (String)
date
- Date object representation of datestring (Date)
language
- Optional language code for date (String)
dateFormat
- Optional format string for date (String) Author Patrick Corcoran
Method Detail |
Object clone()
String format(dateFormat,language)
dateFormat
- Optional format string for date (String)
language
- Optional language code for date (String)
Number getNumberOfDaysInThisMonth()
Number getTime()
Boolean hasTime()
void incrementDay()
void incrementMonth()
void incrementWeek()
<static> String convert2DigitTo4DigitYear(year)
date
- Date object (Date)
language
- Language code for date (String)
<static> String formatDate(date,dateFormat,language)
date
- Date object (Date)
dateFormat
- Format string for date (String)
language
- Language code for date (String)
<static> String get1Digit0To11Hour(date)
date
- Date object (Date)
<static> String get1Digit1To12Hour(date)
date
- Date object (Date)
<static> String get1Digit1To24Hour(date)
date
- Date object (Date)
<static> String get1DigitDayOfMonth(date)
date
- Date object (Date)
<static> String get1DigitMinutes(date)
date
- Date object (Date)
<static> String get1DigitMonth(date)
date
- Date object (Date)
<static> String get1DigitSeconds(date)
date
- Date object (Date)
<static> String get2Digit0To11Hour(date)
date
- Date object (Date)
<static> String get2Digit0To23Hour(date)
date
- Date object (Date)
<static> String get2Digit1To12Hour(date)
date
- Date object (Date)
<static> String get2Digit1To24Hour(date)
date
- Date object (Date)
<static> String get2DigitDayOfMonth(date)
date
- Date object (Date)
<static> String get2DigitMinutes(date)
date
- Date object (Date)
<static> String get2DigitMonth(date)
date
- Date object (Date)
<static> String get2DigitSeconds(date)
date
- Date object (Date)
<static> String get2DigitYear(date)
date
- Date object (Date)
<static> String get3DigitMilliseconds(date)
date
- Date object (Date)
<static> String getAMPM(date,language)
date
- Date object (Date)
language
- Language code for date (String)
<static> Number getNumberOfDaysInMonth(date)
date
- Date object (Date)
<static> Boolean isLeapYear(year)
year
- The year to check (integer or Date)
<static> String validateAndFormatDate(dateString, outputFormat, locale, alertOnFailure, timePolicy, formatList)
dateString
- String to validate (string)
outputFormat
- Format for returned dates (string)
locale
- Locale to use for validation purposes, optional (string)
alertOnFailure
- Whether or not to alert on failure, optional (boolean)
timePolicy
- Policy to use regarding times, optional (integer)
formatList
- Array of format strings for comparison, optional (Array)
<static> Boolean validateDate(dateString, locale, alertOnFailure, timePolicy, formatList)
dateString
- String to validate (String)
locale
- Locale to use for validation purposes (String)
alertOnFailure
- Whether or not to alert on failure, optional (boolean)
timePolicy
- Policy to use regarding times, optional (integer)
formatList
- Array of format strings for comparison, optional (Array)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |