This server class provides methods to operate the SimpleTime class objects, for example, to create the SimpleTime object instances or work with the class fields.
SimpleTime(time)
This method instantiates a new SimpleTime object.
Parameter(s):
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | SimpleTime |
---|
linenumbers | true |
---|
|
const reportTime = new SimpleTime();
ss.info(reportTime.getByFormat());
//Info: 03:00:00 |
This method allows the users to get time value in the format you need.
Parameter(s):
Valuevalue |
---|
format | string | N | "H:i:s" |
Return:
stringString | The time in the specified format. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getByFormat |
---|
linenumbers | true |
---|
|
const reportTime = new SimpleTime();
reportTime.setValue('12:00:00');
ss.info(reportTime.getByFormat('H:i'));
//Info: 12:00 |
getDisplayValue()
This method gets the time in the 'H:i:s' format.
Return:
Type | Description |
---|
String | The time in 'H:i:s'format. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getDisplayValue |
---|
linenumbers | true |
---|
|
const reportTime = new SimpleTime('12:00:00');
ss.info(reportTime.getDisplayValue());
//Info: 12:00:00 |
getHourLocalTime()
The output of this method is the hours in the local time zone.
Return:
Type | Description |
---|
String | The hour(s) of the time. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getHourLocalTime |
---|
linenumbers | true |
---|
|
const reportTime = new SimpleTime();
reportTime.setValue('12:00:00');
ss.info(reportTime.getHourLocalTime());
//Info: 12 |
getHourUTC()
The output of this method is the hour part in the 12-hour clock in the UTC time zone. Noon is represented as 0, midnight is 12.
Return:
Type | Description |
---|
String | The hour part of the time. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getHourUTC |
---|
linenumbers | true |
---|
|
const startPoint = new SimpleTime();
startPoint.setValue('12:00:00');
ss.info(startPoint.getHourUTC());
//Info: 09 |
getValue()
The output of this method is the time value saved in the SimpleTime object having the internal format (‘H:i:s’) and in the system time zone.
Return:
Type | Description |
---|
String | The time value. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | getValue |
---|
linenumbers | true |
---|
|
const startPoint = new SimpleTime('12:00:00');
ss.info(startPoint.getValue());
//Info: 09:00:00 |
setValue(time)
This method defines the time of the SimpleTime object in the internal time zone.
Parameter(s):
Valuevalue |
---|
time | String | N | "00:00:00" |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
theme | Eclipse |
---|
title | setValue |
---|
linenumbers | true |
---|
|
const startPoint = new SimpleTime();
startPoint.setValue('12:00:00');
ss.info(startPoint.getValue());
//Info: 09:00:00 |