Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Fixed parse example.

In this Page

Table of Contents
maxLevel2
excludeAdditional Resources|Related Links|Related Information

...

Description

Parses a string representation of a date, and returns it as YYYY-MM-DDTHH:mm:ss.SSS UTCThe results are of the date-time data type.

This is similar to the JavaScript parse.

Syntax


Code Block
Date.parse(dateString)

This method has the following extensions from the standard:

  • parse(millisFromEpoch) - Return a date object that is initialized with the given number of milliseconds from the epoch. If the parameter to parse() is a number, it will be treated as the number of milliseconds from the epoch (Jan 1, 1970) and a new date object will be created and initialized with that value.
  • parse(dateStringformat) - Parse a date string using a custom format. The second argument is a format string using the same syntax as the Java SimpleDateFormat class.
  • parse(dateNumber, format) - Parse a number as a date using a custom format. The second argument is a format string using the same syntax as the Java SimpleDateFormat class. The number converts to a string and parsed using the given format.
Example

Expression: Date.parse("2011 10 30", "yyyy MM dd")

Result: 2011-10-30T00:00:00.000 UTC

Expression: Date.parse ($['System Modstamp'],"MM/dd/yyyy'T'HH:mm:ss.SSS'Z'")

Result: 2015-04-15T13:23:10.000 UTC

Expression: Date.parse(20160923, \"yyyyMMdd\")") “yyyyMMdd”)

Result: 2016-09-23T00:00:00.000

...

DescriptionThis is similar to the JavaScript getTime - returns the numeric value corresponding to the time for the specified date according to universal time as the number of milliseconds since 1 January 1970 00:00:00 UTC (epoch time). 
Syntax


Code Block
dateobject.getTime()


Example

Expression: Date.now().getTime()

Result: 1487712862069

getUTCDate

Description

Converts the specified time to its corresponding UTC time

Syntax


Code Block
dateobject.getUTCDate()


Example

Expression: Date.parse("2019-03-04T17:32:53.077").getUTCDate()

Result: 4

...

toLocaleDateString

Description

Format the date using the given format as described in an object.

Syntax


Code Block
$datetime.toLocaleDateString(format)


Example

Expression: 'JS_SomeFile' + Date.now().toLocaleDateTimeString({"format":"yyyyMMddhhmmss"}) + '.json'

Result: JS_SomeFile20171106112401.json

...

Description

Returns a copy of this datetime with the specified duration added. 

This is similar to the JavaScript plus.

Syntax


Code Block
$datetime.plus(value)


Example

If Date.now() is 2017-11-06T21:48:11.952 UTC

Expression: Date.now().plus(2)

Result: 2017-11-06T21:48:11.954 UTC 

(last digit increased by 2)


Expression: Date.now().plus(20)

Result2017-11-06T21:48:11.972 UTC

(second to last digit increased by 2)


Expression: Date.now().plus(2000)

Result2017-11-06T21:48:13.952 UTC

(fourth digit from the end increased by 2)

plusDays

Description

Returns a copy of this datetime plus the specified number of days. 

This is similar to the JavaScript plusDays.

Syntax


Code Block
$datetime.plusDays(value)


Example

If Date.now() is 2017-11-06T21:48:11.952 UTC

Expression: Date.now().plusDays(2)

Result: 2017-11-08T21:48:11.952 UTC

(day value increased by 2)

plusHours

Description

Returns a copy of this datetime plus the specified number of hours. 

This is similar to the JavaScript plusHours.

Syntax


Code Block
$datetime.plusHours(value)


Example

If Date.now() is 2017-11-06T21:48:11.952 UTC

Expression: Date.now().plusHours(2)

Result: 2017-11-06T23:48:11.952 UTC

(hour increased by 2)

...