Tries to parse an argument of any type to a standard Date object.
The value to parse. Can be of any type (string, number, Date, etc.).
The parsed Date object, or Invalid Date
if the date
argument was not recognized as a valid date.
Creates a string from a Date object. The resulting string is in the date format required for queries.
The Date object to create a string from.
A string corresponding to the date
argument value, in the YYYY/MM/DD
format.
Creates a string from a Date object. The resulting string is in the datetime format required for queries.
The Date object to create a string from.
A string corresponding to the date
argument value, in the YYYY/MM/DD@HH:mm:ss
format.
Creates a string from a Date object. The resulting string is formatted according to a set of options.
This method calls timeToString
to add time information to the date.
If you need to create a date string without a timestamp, use the dateToString
method instead.
The date object to create a string from.
The set of options to apply when formatting the resulting string. If you do not specify a value for this parameter, the method uses a default set of options.
A date string corresponding to the date
argument value, formatted according to the specified options
.
Creates a string from a Date object. The resulting string is formatted according to a set of options.
This method calls keepOnlyDatePart
to remove time information from the date.
If you need to create a timestamp, use the dateTimeToString
method instead.
The Date object to create a string from.
The set of options to apply when formatting the resulting string. If you do not specify a value for this parameter, the method uses a default set of options.
A date string corresponding to the date
argument value, formatted according to the specified options
.
Validates whether a value is an instance of Date.
The value to verify.
true
if the date
argument is an instance of Date; false
otherwise.
Creates a cropped version of a Date object. The resulting object contains no time information.
The original Date object to create a cropped Date object from.
A cropped Date object corresponding to the date
argument value, excluding its time information.
Creates a string from a number. The resulting string is the localized name of the month that corresponds
to this number (e.g., 0
results in the localized version of January
).
The number to create a string from. Minimum value is 0
(which corresponds to January
). Maximum
value is 11
(which corresponds to December
).
A string whose value is the localized name of the corresponding month
.
Creates an offset version of a Date object. The offset is counted in days.
The original Date object to create an offset Date object from.
The number of days to add to (or subtract from) the date
argument.
An offset Date object corresponding to the date
argument value plus the offset
value.
Creates a string from two Date objects. The resulting string corresponds to the amount of time between those two dates.
The Date object which contains the "oldest" value.
The Date object which contains the "newest" value.
A string whose value corresponds to the amount of time between from
and to
,
or an empty string if either argument was undefined.
Creates a string from a Date object. The string corresponds to the time information of the Date object.
The Date object to create a string from.
The set of options to apply when formatting the resulting string. If you do not specify a value for this parameter, the method uses a default set of options.
A string containing the time information of the date
argument, and formatted according to the specified options
.
The
DateUtils
class exposes methods to convert strings, numbers and date objects to standard ISO 8601 Date objects, using the correct culture, language and format. It also offers methods to convert date objects to strings.