Methods
(static) addHours(time, hoursToAdd) → {number}
- Source:
Add hours to a time.
Parameters:
Name | Type | Description |
---|---|---|
time |
HHMM | |
hoursToAdd |
Returns:
HHMM
- Type
- number
(static) addMinutes(time, minutesToAdd) → {number}
- Source:
Add minutes to a time
Parameters:
Name | Type | Description |
---|---|---|
time |
HHMM | |
minutesToAdd |
Returns:
HHMM
- Type
- number
(static) current() → {number}
- Source:
Returns the current time in HHMM format.
Returns:
HHMM
- Type
- number
(static) dateToTime(dt) → {number}
- Source:
Convert a Date object into a numeric time HHMM
dropping the date portion.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date |
Returns:
HHMM
- Type
- number
(static) diff(t1, t2) → {null|number}
- Source:
Returns the total minutes between two times.
Parameters:
Name | Type | Description |
---|---|---|
t1 |
number | HHMM |
t2 |
number | HHMM |
Returns:
- Type
- null | number
(static) format(val, zero_fill) → {string}
- Source:
Format time.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
val |
Date | number | integer HHMM or Date object | |
zero_fill |
boolean |
false
|
Returns:
hh:mm XM
- Type
- string
(static) formatLong(dt) → {string}
- Source:
Format time with timezone.
Parameters:
Name | Type | Description |
---|---|---|
dt |
Date |
Returns:
hh:mm XM XST
- Type
- string
(static) hours(time) → {number}
- Source:
Returns the hours portion of a time in an integer representation formatted HHMM
Parameters:
Name | Type | Description |
---|---|---|
time |
number | HHMM |
Returns:
- Type
- number
(static) isValid(time) → {boolean}
- Source:
Is argument a valid numeric or string time?
Note: This function should probably not be called if you are going to follow it up with a call to
strToInt(). The reason is that this function calls that function. You would be calling it twice.
Just call strToInt() and compare it to null.
Parameters:
Name | Type | Description |
---|---|---|
time |
number | string | numeric or string time |
Returns:
- Type
- boolean
(static) millsToInt(m) → {number}
- Source:
- See:
-
- DateTimeUtils.toMilliseconds()
- DateUtils.millsToInt()
Convert a number of milliseconds since 1970 UTC to an integer time HHMM.
This takes into account the local timezone.
Parameters:
Name | Type | Description |
---|---|---|
m |
number | number of milliseconds since 1970 UTC |
Returns:
HHMM
- Type
- number
(static) minutes(time) → {number}
- Source:
Returns the minutes portion of a time in an integer representation formatted HHMM
Parameters:
Name | Type | Description |
---|---|---|
time |
number | HHMM |
Returns:
- Type
- number
(static) minutesToTime(m) → {number}
- Source:
Convert a number of minutes into standard time format (HHMM).
Parameters:
Name | Type | Description |
---|---|---|
m |
number | number of minutes |
Returns:
HHMM
- Type
- number
(static) strToInt(sval) → {null|number}
- Source:
Convert a string time into an integer time.
Parameters:
Name | Type | Description |
---|---|---|
sval |
string | "11:30 AM", "1130", "11:30pm", "11.30", accepts military time too, etc. |
Returns:
integer formatted as HHMM or null if not a time
- Type
- null | number
(static) totalMinutes(time) → {null|number}
- Source:
Returns the total minutes in a time.
Parameters:
Name | Type | Description |
---|---|---|
time |
number | HHMM |
Returns:
- Type
- null | number