Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This class provides methods for performing operations on SimpleDateTime objects, such as instantiating objects, for example.
You can also use this class to perform date-time operations, such as calculations, formatting or converting between date-time formats.
addDaysLocalTime(days)
Adds a specified number of days to the current SimpleDateTime object. The negative value of the parameter will subtract the days.
The method determines local date and time equivalent to the value saved by the GlideDateTime object, then adds or subtracts the days using local date and time values.
Parameter(s):
Name | Type |
---|---|
days | Integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00"); simple_date_time.addDaysLocalTime(-1) ss.info(simple_date_time.getValue()); // 2018-12-31 |
addDaysUTC(days)
Adds a specified number of days to the current SimpleDateTime object. The negative value of the parameter will subtract the days.
The method determines UTC date and time equivalent to the value saved by the GlideDateTime object, then adds or subtracts the days using UTC date and time values.
Parameter(s):
Name | Type |
---|---|
days | integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00"); simple_date_time.addDaysUTC(-1) ss.info(simple_date_time.getValue()); // 2018-12-31 08:00:00 |
addMonthsLocalTime(months)
Adds a specified number of months to the current SimpleDateTime object. The negative value of the parameter will subtract the months.
The method determines local date and time equivalent to the value saved by the GlideDateTime object, then adds or subtracts the months using local date and time values.
Parameter(s):
Name | Type |
---|---|
months | Integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addMonthsLocalTime(1)
ss.info(simple_date_time.getValue()); // 2019-02-01 |
addSeconds(seconds)
Add a specified number of seconds to the current SimpleDateTime object.
Parameter(s):
Name | Type |
---|---|
seconds | Integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00"); simple_date_time.addSeconds(3600); ss.info(simple_date_time.getValue()); // 2019-01-01 09:00:00 |
addWeeksLocalTime(weeks)
Adds a specified number of weeks to the current SimpleDateTime object. The negative value of the parameter will subtract the weeks.
The method determines local date and time equivalent to the value saved by the GlideDateTime object, then adds or subtracts the weeks using local date and time values.
Parameter(s):
Name | Type |
---|---|
weeks | integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00"); simple_date_time.addWeeksLocalTime(2) ss.info(simple_date_time.getValue()); // 2019-01-15 |
addWeeksUTC(weeks)
Adds a specified number of weeks to the current SimpleDateTime object. The negative value of the parameter will subtract the weeks.
The method determines UTC date and time equivalent to the value saved by the GlideDateTime object, then adds or subtracts the weeks using UTC date and time values.
Parameter(s):
Name | Type |
---|---|
weeks | Integer |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addWeeksUTC(-1)
ss.info(simple_date_time.getValue()); // 2018-12-25 08:00:00 |
Table of Contents | ||
---|---|---|
|