Methods
(static) addHours(dt, hours) → {Date}
- Source:
Add hours to a date.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date | number | string | |
hours |
number |
Returns:
- Type
- Date
(static) addMinutes(dt, minutes) → {Date}
- Source:
Add minutes to a date.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date | number | string | |
minutes |
number |
Returns:
- Type
- Date
(static) createDate(dt, tm) → {Date}
- Source:
Convert in integer date and integer time into a Date object.
Parameters:
Name | Type | Description |
---|---|---|
dt |
YYYYMMDD | |
tm |
HHMM |
Returns:
- Type
- Date
(static) dateToIntTime(dt) → {number}
- Source:
Convert a Date object into in integer time.
Ignores / removes the date component.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date |
Returns:
HHMM
- Type
- number
(static) dateToStd(dt) → {string}
- Source:
Format a Date into a standard format useful for data interchange.
For example: 2022-06-08 03:27:44 360
The 360 is minutes offset from GMT - the timezone
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date |
Returns:
- Type
- string
(static) formatDate(dt) → {string}
- Source:
Format a Date or number of milliseconds since 1970 UTC to a string representation
looking like mm/dd/yyyy hh:mm AM/PM or dd/mm/yyyy hh:mm AM/PM (if locally appropriate)
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date | string | number |
Returns:
- Type
- string
(static) formatDateLong(dt) → {string}
- Source:
Format a Date in a full format. For example: Wed Jan 4, 2022 12:31 PM CST
dt
can be a Date
object or the number of milliseconds since 1970.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date | number |
Returns:
- Type
- string
(static) formatDateTime(dt, time) → {string}
- Source:
Format a date and time into a single string.
Parameters:
Name | Type | Description |
---|---|---|
dt |
number | YYYYMMDD |
time |
number | HHMM |
Returns:
mm/dd/yyyy hh:mm AM/PM
- Type
- string
(static) getLocalTimezoneLongText() → {string}
- Source:
Returns the local long timezone text.
For example "American/Chicago"
Returns:
- Type
- string
(static) getLocalTimezoneShortText() → {string}
- Source:
Returns the local short timezone text.
For example "CST"
Returns:
- Type
- string
(static) stdToDate(sdt) → {Date}
- Source:
Parse a standard string date format into a Date object.
Expected standard date format looks like this: 2022-06-08 03:27:44 300
The 300 is minutes offset from GMT - the timezone
This routine parses a date from any timezone and returns a Date object in the local timezone.
Parameters:
Name | Type | Description |
---|---|---|
sdt |
string |
Returns:
- Type
- Date
(static) toMilliseconds(date, time) → {number}
- Source:
- See:
-
- DateUtils.millsToInt()
- TimeUtils.millsToInt()
Combine a date and time into the number of milliseconds since 1970 UTC.
This is very valuable when trying to transit a DateTime to a backend without losing timezone info.
Parameters:
Name | Type | Description |
---|---|---|
date |
number | Date | YYYYMMDD (time portion of a Date is not used) |
time |
number | null | undefined | HHMM |
Returns:
- Type
- number