Home Reference Source
public class | source

DateUtils

Extends:

TypedObject → DateUtils

Static Method Summary

Static Public Methods
public static

dateAdd(datePart: *, number: *, date: *): *

Adds the specified number of "date parts" to a date, e.g.

public static

dateDiff(datePart: *, startDate: *, endDate: *): *

Determines the number of "dateParts" difference between 2 dates

public static

dateTimeFormat(date: *, mask: *): *

Formats a date into a certain date/time format

public static

dayOfWeek(date: *): *

Gets the day of the week

public static

dayOfWeekAsNumber(strDayOfWeek: *): *

Formats a date to the numeric version of the day of the week

public static

dayOfWeekAsString(date: *): *

Formats a date to the string version of the day of the week

public static

dayOfWeekIterationOfMonth(iteration: *, strDayOfWeek: *, date: *): *

Gets the Xth day of the month.

public static

dayOfYear(date: *): *

Gets the ordinal value or day of the year

public static

daysInMonth(date: *): *

Gets the days in the month

public static

daysInYear(date: *): *

Gets the number of days in the year

public static

formatString(date: *, mask: *): *

Formats a date into a certain date format

public static

getTimeFormat(date: *, mask: *): *

Formats a time into a certain time format

public static

isDate(value: String): *

Determines whether a value is actually a valid date

public static

isLeapYear(date: *): *

Determines whether the year is a leap year or not

public static

monthAsNumber(strMonth: *): *

Formats a month to the numeric version of the month

public static

monthAsString(date: *): *

Formats a date to the string version of the month

public static

toFlexDayOfWeek(localDayOfWeek: Number): Number

Converts the day of the week to a Flex day of the week

public static

toFlexMonth(localMonth: Number): Number

Converts the month to a Flex month

public static

totalDayOfWeekInMonth(strDayOfWeek: *, date: *): Number

Gets the total number of dayOfWeek in the month

public static

weekOfYear(date: *): *

Gets the week of the year

Method Summary

Public Methods
public

Inherited Summary

From class TypedObject
public

typeCache: {}

public
public

Returns a list of strings that represent the object hierarchy for this object.

public

Returns true if the class name to check is in the list of class names defined for this class.

Static Public Methods

public static dateAdd(datePart: *, number: *, date: *): * source

Adds the specified number of "date parts" to a date, e.g. 6 days

Params:

NameTypeAttributeDescription
datePart *

The part of the date that will be added

number *

The total number of "dateParts" to add to the date

date *

The date on which to add

Return:

*

The new date

public static dateDiff(datePart: *, startDate: *, endDate: *): * source

Determines the number of "dateParts" difference between 2 dates

Params:

NameTypeAttributeDescription
datePart *

The part of the date that will be checked

startDate *

The starting date

endDate *

The ending date

Return:

*

The number of "dateParts" difference

public static dateTimeFormat(date: *, mask: *): * source

Formats a date into a certain date/time format

Params:

NameTypeAttributeDescription
date *

The date to format

mask *

How the date should be formatted

Return:

*

A formatted date

public static dayOfWeek(date: *): * source

Gets the day of the week

Params:

NameTypeAttributeDescription
date *

The date for which to get the day of the week

Return:

*

A number representing the day of the week, 0 to 6

public static dayOfWeekAsNumber(strDayOfWeek: *): * source

Formats a date to the numeric version of the day of the week

Params:

NameTypeAttributeDescription
strDayOfWeek *

The day of week to convert

Return:

*

A formatted day of week or -1 if day not found

public static dayOfWeekAsString(date: *): * source

Formats a date to the string version of the day of the week

Params:

NameTypeAttributeDescription
date *

The date to format

Return:

*

A formatted day of week

public static dayOfWeekIterationOfMonth(iteration: *, strDayOfWeek: *, date: *): * source

Gets the Xth day of the month. e.g. get the 3rd Wednesday of the month

Params:

NameTypeAttributeDescription
iteration *

The iteration of the month to get e.g. 4th or Last

strDayOfWeek *

The day of the week as a string

date *

The date containing the month and year

Return:

*

The date of the xth dayOfWeek of the month

public static dayOfYear(date: *): * source

Gets the ordinal value or day of the year

Params:

NameTypeAttributeDescription
date *

The date for which to get the day of the year

Return:

*

A number representing the day of the year, 1 to 365 or 366 for a leap year

public static daysInMonth(date: *): * source

Gets the days in the month

Params:

NameTypeAttributeDescription
date *

The date to check

Return:

*

The number of days in the month

public static daysInYear(date: *): * source

Gets the number of days in the year

Params:

NameTypeAttributeDescription
date *

The date to check

Return:

*

The total number of days in the year

public static formatString(date: *, mask: *): * source

Formats a date into a certain date format

Params:

NameTypeAttributeDescription
date *

The date to format

mask *

How the date should be formatted

Return:

*

A formatted date

public static getTimeFormat(date: *, mask: *): * source

Formats a time into a certain time format

Params:

NameTypeAttributeDescription
date *

The date to format

mask *

How the date should be formatted

Return:

*

A formatted time

public static isDate(value: String): * source

Determines whether a value is actually a valid date

Params:

NameTypeAttributeDescription
value String

The date value

Return:

*

true means this is a valid date, false means it is not a valid date

public static isLeapYear(date: *): * source

Determines whether the year is a leap year or not

Params:

NameTypeAttributeDescription
date *

The date to check

Return:

*

true means it is a leap year, false means it is not a leap year.

public static monthAsNumber(strMonth: *): * source

Formats a month to the numeric version of the month

Params:

NameTypeAttributeDescription
strMonth *

The month to convert

Return:

*

A formatted month or -1 if month not found

public static monthAsString(date: *): * source

Formats a date to the string version of the month

Params:

NameTypeAttributeDescription
date *

The date to format

Return:

*

A formatted month

public static toFlexDayOfWeek(localDayOfWeek: Number): Number source

Converts the day of the week to a Flex day of the week

Params:

NameTypeAttributeDescription
localDayOfWeek Number

The human readable day of week

Return:

Number

The Flex converted day of week or 0 aka Sunday

public static toFlexMonth(localMonth: Number): Number source

Converts the month to a Flex month

Params:

NameTypeAttributeDescription
localMonth Number

The human readable month

Return:

Number

The Flex converted month or 0 aka January

public static totalDayOfWeekInMonth(strDayOfWeek: *, date: *): Number source

Gets the total number of dayOfWeek in the month

Params:

NameTypeAttributeDescription
strDayOfWeek *

The day of week to check

date *

The date containing the month and year

Return:

Number

The number of strDayOfWeek in that month and year

public static weekOfYear(date: *): * source

Gets the week of the year

Params:

NameTypeAttributeDescription
date *

The date for which to get the week of the year

Return:

*

A number representing the week of the year, 1 to 53 ( as there are slightly more than 52 weeks of days in a year)

Public Methods

public getClassNames(): string source

Returns a list of strings that represent the object hierarchy for this object.

Override:

TypedObject#getClassNames

Return:

string