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
This method 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 SimpleDateTime object, then adds or subtracts the days using local date and time values.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
days | Integerinteger | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addDaysLocalTimeaddDaysUTC |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addDaysLocalTimeaddDays(-1)
ss.info(simple_date_time.getValue()); // 2018-12-31 |
addDaysUTC(days
This method adds a specified number of days months to the current SimpleDateTime object. The negative value of the parameter will subtract the daysmonths.
The method determines UTC local date and time equivalent time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the days months using UTC local date and time values.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
daysmonths | integerInteger | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addDaysUTCaddMonthsUTCTime |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addDaysUTCaddMonths(-1)
ss.info(simple_date_time.getValue()); // 2018-12-3101 08:00:00 |
addMonthsLocalTime
monthsThis method adds a specified number of months seconds 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 SimpleDateTime object, then adds or subtracts the months using local date and time values.
Parameter(s):
Parameter(s):
Name | Name | Type | Mandatory | Default Value |
---|
monthsseconds | Integer | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addMonthsLocalTimeaddSeconds |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addMonthsLocalTimeaddSeconds(13600);
ss.info(simple_date_time.getValue()); // 2019-0201-01 |
addMonthsUTC(months
This method adds a specified number of months weeks to the current SimpleDateTime object. The negative value of the parameter will subtract the monthsweeks.
The method determines UTC local date and time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the months weeks using UTC local date and time values.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
monthsweeks | Integer | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addMonthsUTCTimeaddWeeksUTC |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addMonthsUTCaddWeeks(-1)
ss.info(simple_date_time.getValue()); // 2018-12-0125 08:00:00 |
addSeconds
secondsThis method adds a specified number of seconds years to the current SimpleDateTime object. The negative value of the parameter will subtract the years.
The method determines local date and time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the years using local date and time values.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
secondsyears | Integer | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addSecondsaddYearsLocalTime |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addSecondsaddYears(36001);
ss.info(simple_date_time.getValue()); // 20192020-01-01 09:00:00 |
addWeeksLocalTime(weeks
This method 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 SimpleDateTime object, then adds or subtracts the weeks using local date and time valuesallows to compare the date specified by the ‘dateTime‘ parameter with the current date. The method returns TRUE, if the current date is after the specified; otherwise returns FALSE.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
weeksdateTime | integerSimpleDateTime object | Y | N |
Return:
VoidThis method does not return a valueThe method returns TRUE if the current date is later than the date specified by the parameter; otherwise, returns FALSE. |
Example:
Code Block |
---|
language | js |
---|
title | addWeeksLocalTimeafter |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time.addWeeksLocalTime(2)
ss.info( = new SimpleDateTime("2018-01-01 08:00:00");
let result = first_simple_date_time.getValue());after(second_simple_date_time);
ss.info(result) // 2019-01-15 |
addWeeksUTC(weeks
This method adds a specified number of weeks to the current SimpleDateTime object. The negative value of the parameter will subtract the weeksallows to compare the date specified by the ‘dateTime‘ parameter with the current date.
The method determines UTC date and time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the weeks using UTC date and time valuesreturns TRUE, if the current date is before the specified; otherwise returns false.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
weeksdateTime | IntegerSimpleDateTime object | Y | N |
Return:
VoidThis method does not return a valueThe method returns TRUE if the current date is earlier than the date specified by the parameter; otherwise, returns FALSE. |
Example:
Code Block |
---|
language | js |
---|
title | addWeeksUTCbefore |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time.addWeeksUTC(-1)
ss.info( = new SimpleDateTime("2018-01-01 08:00:00");
let result = first_simple_date_time.before(second_simple_date_time);
ss.getValueinfo()result); // 2018-12-25 08:00:00 |
addYearsLocalTime(years
This method adds a specified number of years to the current SimpleDateTime object. The negative value of the parameter will subtract the years.The method determines local date and time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the years using local date and time valuescompares two date and time objects to determine whether they are equivalent or not.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
YearsdateTime | IntegerSimpleDateTime object | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
0 | Dates are equal |
1 | Object's date is after the date specified in the parameter. |
-1 | Object's date is before the date specified in the parameter. |
Example:
Code Block |
---|
|
Code Block |
---|
language | js |
---|
title | addYearsLocalTimecompareTo |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time.addYearsLocalTime(1)
ss.info(simple_date_time.getValue()); // 2020-01-01 |
This method adds a specified number of years to the current SimpleDateTime object. The negative value of the parameter will subtract the years.
The method determines UTC date and time equivalent to the value saved by the SimpleDateTime object, then adds or subtracts the years using UTC date and time values.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
Years | Integer | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
language | js |
---|
title | addYearsLocalTime |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
simple_date_time.addYearsLocalTime(1)
ss.info(simple_date_time.getValue()); // 2020-01-01 |
This method allows to compare the date specified by the ‘dateTime‘ parameter with the current date. The method returns TRUE, if the current date is after the specified; otherwise returns FALSE.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | SimpleDateTime object | Y | N |
Return:
Type | Description |
---|
Boolean | The method returns TRUE if the current date is later than the date specified by the parameter; otherwise, returns FALSE. |
Example:
Code Block |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time = new SimpleDateTime("2018-01-01 08:00:00");
let result = first_simple_date_time.after(second_simple_date_time);
ss.info(result) // true |
This method allows to compare the date specified by the ‘dateTime‘ parameter with the current date.
The method returns TRUE, if the current date is before the specified; otherwise returns false.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | SimpleDateTime object | Y | N |
Return:
Type | Description |
---|
Boolean | The method returns TRUE if the current date is earlier than the date specified by the parameter; otherwise, returns FALSE. |
Example:
Code Block |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time = new SimpleDateTime("2018-01-01 08:00:00");
let result = first_simple_date_time.before(second_simple_date_time);
ss.info(result) // false |
This method compares two date and time objects to determine whether they are equivalent or not.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | SimpleDateTime object | Y | N |
Return:
Type | Description |
---|
0 | Dates are equal |
1 | Object's date is after the date specified in the parameter. |
-1 | Object's date is before the date specified in the parameter. |
Example:
Code Block |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var second_simple_date_time = new SimpleDateTime("2018-01-01 08:00:00");
var third_simple_date_time = new SimpleDateTime("2018-01-01 08:00:00");
var third_simple_date_time = new SimpleDateTime("2018-01-01 08:00:00");
ss.info( first_simple_date_time.compareTo(second_simple_date_time) ); // 1
ss.info( second_simple_date_time.compareTo(first_simple_date_time) ); // -1
ss.info( third_simple_date_time.compareTo(second_simple_date_time ) ); // 0 |
This method compares a datetime with an existing value if they are equal.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | SimpleDateTime object. | Y | N |
Return:
Type | Description |
---|
Boolean | This method returns TRUE if the date are equal; otherwise, it returns FALSE. |
Example:
Code Block |
---|
|
var 1
ss.info( second_simple_date_time.compareTo(first_simple_date_time) =); new SimpleDateTime("2019-01-01 08:00:00");
var // -1
ss.info( third_simple_date_time.compareTo(second_simple_date_time ) =); // 0 |
This method compares a datetime with an existing value if they are equal.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | SimpleDateTime object. | Y | N |
Return:
Type | Description |
---|
Boolean | This method returns TRUE if the date are equal; otherwise, it returns FALSE. |
Example:
Code Block |
---|
|
var firstnew SimpleDateTime("2018-01-01 08:00:00");
var third_simple_date_time = new SimpleDateTime("20182019-01-01 08:00:00");
ss.info( first_simple_date_time.equals(second_simple_date_time) ); // 0
ss.info( third_simple_date_time.equals(
var second_simple_date_time )= ); // 1 |
This method returns the date stored by the GlideDateTime object, showed in the system time zone.
Return:
Type | Description |
---|
String | The date in the default timezone. |
Example:
Code Block |
---|
|
var firstnew SimpleDateTime("2018-01-01 08:00:00");
var third_simple_date_time = new SimpleDateTime("20192018-01-01 08:00:00");
ss.info( first_simple_date_time.equals(second_simple_date_time) ); // 0
ss.info( third_simple_date_time.getDate(equals(second_simple_date_time ) ); // 2019-01-01 |
getDaysInMonthLocalTime
This method returns the number of days in the month saved date stored by the SimpleDateTime GlideDateTime object, showed in the user's system time zone.
Return:
Integer number of days valuedate in the default timezone. |
Example:
Code Block |
---|
language | js |
---|
title | getDaysInMonthLocalTimegetDate |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDaysInMonthLocalTimegetDate() ); // 31 |
getDayOfMonthLocalTime
This method returns the day number of days in the month saved by the SimpleDateTime object, showed in the user's time zone.
Return:
Type | Description |
---|
Integer | The |
day the month
Example:
Code Block |
---|
language | js |
---|
title | getDaysofMonthsLocalTimegetDaysInMonthLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDayOfMonthLocalTimegetDaysInMonthLocalTime() ); // 131 |
getDayOfMonthUTC
This method returns the day of the month saved by the SimpleDateTime object, showed in the UTC user's time zone.
Return:
Type | Description |
---|
Integer | The day of the month value. |
Example:
Code Block |
---|
language | js |
---|
title | getDaysofMonthsLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDayOfMonthUTCgetDayOfMonthLocalTime() ); // 1 |
getDayOfWeekLocalTime
This method returns the day of the week month saved by the SimpleDateTime object, showed in the user's UTC time zone.
Return:
Example:
Code Block |
---|
language | js |
---|
title | getDayOfWeekLocalTimegetDaysofMonthsLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDayOfWeekLocalTimegetDayOfMonthUTC() ); // Tue |
getDayOfWeekUTC
This method returns the day of the week saved by the SimpleDateTime object, showed in the system user's time zone.
Return:
Type | Description |
---|
String | The day of week value. |
Example:
Code Block |
---|
language | js |
---|
title | getDayOfWeekUTCgetDayOfWeekLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDayOfWeekUTCgetDayOfWeekLocalTime() ); // Tue |
getDaysInMonthUTC
This method returns the number day of days in the month week saved by the SimpleDateTime object, showed in the system time zone.
Return:
Example:
Code Block |
---|
language | js |
---|
title | getDaysInMonthUTCgetDayOfWeekUTC |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDaysInMonthUTCgetDayOfWeekUTC() ); |
getDisplayValueThis method gets the date and time value in the current user's display format and timezonereturns the number of days in the month saved by the SimpleDateTime object, showed in the system time zone.
Return:
Example:
Code Block |
---|
language | js |
---|
title | getDisplayValuegetDaysInMonthUTC |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getDisplayValuegetDaysInMonthUTC() ) ; //uses current user session time zone |
getErrorMsg
This method gets the error message if the SimpleDateTime object was incorrectdate and time value in the current user's display format and timezone.
Return:
Example:
Code Block |
---|
language | js |
---|
title | getErrorMsggetDisplayValue |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-zz01-01 08:00:00");
ss.info( first_simple_date_time.getErrorMsggetDisplayValue() ) ; //Theuses parsedcurrent dateuser orsession time was invalid! |
getLocalDate
This method returns the date stored by gets the error message if the SimpleDateTime object , showed in the user's time zonewas incorrect.
Return:
date in the user's time zone
Example:
Code Block |
---|
language | js |
---|
title | getLocalDategetErrorMsg |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01zz-01 08:00:00");
ss.info( first_simple_date_time.getLocalDate() ) |
getLocalTimegetErrorMsg() ) ; //The parsed date or time was invalid! |
This method returns a the date stored by the SimpleDateTime object that shows the time , showed in the user's time zone.
Return:
SimpleDateTime time date in the user's time zone. |
Example:
Code Block |
---|
language | js |
---|
title | getLocalTimegetLocalDate |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var time =ss.info( first_simple_date_time.getLocalTime();
ss.info( "My local time is " + time.getByFormat('h:m:s'getLocalDate() ) ; |
getMonthLocalTime
This method returns the month saved by a SimpleDateTime object , showed that shows the time in the current user's time zone.
Return:
String value of the monthtime in the user's time zone. |
Example:
Code Block |
---|
language | js |
---|
title | getMonthLocalTimegetLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info(var time = first_simple_date_time.getLocalTime();
ss.info( "My local time.getMonthLocalTime( is " + time.getByFormat('h:m:s') ) ; // January |
getMonthUTC
This method returns the month saved by SimpleDateTime object, showed in the system current user's time zone.
Return:
Type | Description |
---|
String | The value of the month. |
Example:
Code Block |
---|
language | js |
---|
title | getMonthUTCgetMonthLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getMonthUTCgetMonthLocalTime() ); // January |
getNumericValue
This method gets the timestamp which stores the amount of milliseconds since January 1, 1970, 00:00:00returns the month saved by SimpleDateTime object, showed in the system time zone.
Return:
Example:
Code Block |
---|
language | js |
---|
title | getNumericValuegetMonthUTC |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getNumericValuegetMonthUTC() ) ; // 1546318800 |
getTime
This method returns a SimpleDateTime object that shows the piece of time of the SimpleDateTime objectgets the timestamp which stores the amount of milliseconds since January 1, 1970, 00:00:00.
Return:
SimpleDateTime Unix duration stamp
Example:
Code Block |
---|
language | js |
---|
title | getTimegetNumericValue |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var time = ss.info( first_simple_date_time.getTime();
ss.info( time.getByFormat('h:m:s'time.getNumericValue() ) ; // 1546318800 |
getValue
This method gets the date and time value in the internal formatreturns a SimpleDateTime object that shows the piece of time of the SimpleDateTime object.
Return:
null | string | The date and time value in the internal formatSimpleDateTime | The Unix duration stamp. |
Example:
Code Block |
---|
language | js |
---|
title | getValuegetTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info(var time = first_simple_date_time.getTime();
ss.info( time.getValue(getByFormat('h:m:s') ); //2019-01-01 08:00:00 |
getWeekOfYearLocalTime
This method returns the number of the week saved by the SimpleDateTime object, showed in the user's time-zonegets the date and time value in the internal format.
Return:
Integer number of the current weekdate and time value in the internal format. |
Example:
Code Block |
---|
language | js |
---|
title | getWeekOfYearLocalTimegetValue |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getWeekOfYearLocalTimegetValue() ); // 1 |
getWeekOfYearUTC
This method returns the number of the week saved by the SimpleDateTime object, showed in the system user's time-zone.
Return:
Type | Description |
---|
Integer | The number of the current week. |
Example:
Code Block |
---|
language | js |
---|
title | getWeekOfYearUTCgetWeekOfYearLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getWeekOfYearUTCgetWeekOfYearLocalTime() ); // 1 |
getYearLocalTime
This method returns the year number of the week saved by the SimpleDateTime object, showed in the user's system time-zone.
Return:
Four-digit year valueThe number of the current week. |
Example:
Code Block |
---|
language | js |
---|
title | getYearLocalTimegetWeekOfYearUTC |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getYearLocalTimegetWeekOfYearUTC() ); |
getYearUTC
This method returns the year saved by the SimpleDateTime object, showed in the system user's time zone.
Return:
Type | Description |
---|
Integer | Four-digit year value. |
Example:
Code Block |
---|
language | js |
---|
title | getYearUTCgetYearLocalTime |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
ss.info( first_simple_date_time.getYearUTCgetYearLocalTime() ); |
isValid
This method allows to determine if a specified value is a valid date and time. returns the year saved by the SimpleDateTime object, showed in the system time zone.
Return:
Boolean | The method returns TRUE if the value is a valid date and time; otherwise, it returns FALSEInteger | Four-digit year value. |
Example:
Code Block |
---|
language | js |
---|
title | isValidgetYearUTC |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
first_simple_date_time.setDisplayValue("2011-aa SimpleDateTime("2019-01-01 0008:00:00");
ss.info( first_simple_date_time.isValid() ) ; // false |
This method sets the dateTime value using the current user's display format and time zone.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | String | Y | N |
This method allows to determine if a specified value is a valid date and time.
format | String | N | ''
Return:
VoidThis method does not return a valueThe method returns TRUE if the value is a valid date and time; otherwise, it returns FALSE. |
Example:
Code Block |
---|
language | js |
---|
title | setDisplayValueisValid |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
first_simple_date_time.setDisplayValue("20202011-01aa-01 1200:00:00");
ss.info( first_simple_date_time.getValueisValid() ) ; // false |
This method sets the date and time of the SimpleDateTime object.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
dateTime | A string in the UTC local time zone and the internal format of yyyy-MM-dd HH:mm:ss. | Y | N |
dateTime | A SimpleDateTime object, | Y | N |
dateTime | A JavaScript Number. It sets the value of the object using the Number value as milliseconds past January 1, 1970, 00:00:00. | Y | N |
Return:
Type | Description |
---|
Void | This method does not return a value. |
Example:
Code Block |
---|
|
var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
first_simple_date_time.setValue("2020-01-01 12:00:00");
ss.info( first_simple_date_time.getValue() ); // 2020-01-01 12:00:00 |
This method gets the duration between to SimpleDateTime values. Also, it can subtract the amount of time from the current SimpleDateTime object.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|
first | SimpleDateTime Object | Y | N |
first | SimpleTime Object | Y | N |
first | Number (milliseconds) | Y | N |
second | SimpleDateTime Object | N | NULL |
second | SimpleTime Object | N | NULL |
second | Number (milliseconds) | N | NULL |
Return:
Type |
---|
SimpleDuration object |
Example:
Code Block |
---|
|
var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
var simple_time = new SimpleTime();
simple_time.setValue("00:00:20");
simple_date_time.subtract(simple_time);
var second_simple_time = simple_date_time.getTime();
ss.info( second_simple_time.getByFormat('h:m:s') ); // 2019-01-01 07:59:40 |