Methods
(static) divide(nDuration, nPartQtyopt, bAddStringsopt) → {Object}
- Source:
Separate time duration into parts.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nDuration |
Integer | Time duration in milliseconds. | |
nPartQty |
Integer |
<optional> |
Parts quantity. The default value is 3.
The following values are allowed:
|
bAddStrings |
Boolean |
<optional> |
Specifies whether additional string fields should be included into result object.
An additional field represents a value of calculated part that is converted into string
and is prefixed with "0" if it is necessary (i.e. values from 0 to 9 are converted to "00"-"09").
The default value is false . |
Returns:
Object representing the requested parts of time duration. Can contain the following fields.
Name | Type | Description |
---|---|---|
day | Integer | Quantity of full days |
day2 | String |
Quantity of full days. String contains at least 2 characters.
This field is included only when bAddStrings has true value.
|
hour | Integer | Quantity of full hours |
hour2 | String |
Quantity of full hours. String contains at least 2 characters.
This field is included only when bAddStrings has true value.
|
minute | Integer | Quantity of full minutes |
minute2 | String |
Quantity of full minutes. String contains at least 2 characters.
This field is included only when bAddStrings has true value.
|
second | Integer | Quantity of full seconds |
second2 | String |
Quantity of full seconds. String contains at least 2 characters.
This field is included only when bAddStrings has true value.
|
week | Integer | Quantity of full weeks |
week2 | String |
Quantity of full weeks. String contains at least 2 characters.
This field is included only when bAddStrings has true value.
|
- Type
- Object
(static) format(nDuration, sFormatopt) → {String}
- Source:
Convert time duration into string.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
nDuration |
Integer | Time duration in milliseconds. | |
sFormat |
String |
<optional> |
Format of the returned value. The default value is hh:mm:ss .The following tokens are interpreted in special way:
|
Returns:
String representing time duration depending of format.
- Type
- String