SimpleTime
This server class provides methods to operate the SimpleTime class objects. For example, use this class to create the SimpleTime object instances or work with the class fields.
SimpleTime(time)
Use this constructor to instantiate a new SimpleTime object.
Parameter(s):
Name | Type | Mandatory | Default value |
---|---|---|---|
time | Integer | N | 0 |
Example:
const reportTime = new SimpleTime();
ss.info(reportTime.getByFormat());
//Info: 03:00:00
getByFormat(format)
Use this method to get time value in the format you need.
Parameter(s):
Name | Type | Mandatory | Default value |
---|---|---|---|
format | String | N | "H:i:s" |
Return:
Type | Description |
---|---|
String | This method returns the time in the specified format. |
Example:
const reportTime = new SimpleTime();
reportTime.setValue('12:00:00');
ss.info(reportTime.getByFormat('H:i'));
//Info: 12:00
getDisplayValue()
Use this method to get the time in the 'H:i:s' format.
Return:
Type | Description |
---|---|
String | This method returns the time in the 'H:i:s'format. |
Example:
const reportTime = new SimpleTime('12:00:00');
ss.info(reportTime.getDisplayValue());
//Info: 12:00:00
getHourLocalTime()
Use this method to get the hours of the current time in the local time zone.
Return:
Type | Description |
---|---|
String | This method returns the hour(s) of the time. |
const reportTime = new SimpleTime();
reportTime.setValue('12:00:00');
ss.info(reportTime.getHourLocalTime());
//Info: 12
getHourUTC()
Use this method to get the hours of the current time in UTC.
Return:
Type | Description |
---|---|
String | This method returns the hour(s) of the time in UTC. |
const startPoint = new SimpleTime();
startPoint.setValue('12:00:00');
ss.info(startPoint.getHourUTC());
//Info: 09
getValue()
Use this method to get a time value stored in the SimpleTime object that has the internal format (‘H:i:s’) and is in the system time zone.
Return:
Type | Description |
---|---|
String | This method returns the time value. |
const startPoint = new SimpleTime('12:00:00');
ss.info(startPoint.getValue());
//Info: 09:00:00
setValue(time)
Use this method to determine the time of the SimpleTime object in the current time zone.
Parameter(s):
Name | Type | Mandatory | Default value |
---|---|---|---|
time | String | N | "00:00:00" |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
const startPoint = new SimpleTime();
startPoint.setValue('12:00:00');
ss.info(startPoint.getValue());
//Info: 09:00:00