Date-functions

Date-functions are statically bound to "date" -namespace. If output-type is other than Object then it is explicitly written out.

now() <Object>

Now returns the current date and time as an Object. The resulting Object has the following Number-fields, except TimeZone, which is an Object.

  • Year
  • Month
  • Day
  • Hour
  • Minute
  • Second
  • Millisecond
  • TimeZone
  • TimeZone.Id

Example

add(amount <Number>, field <String>, date <Object>) <Object>

Add adds the given number amount for the given field into the given date-object.

NOTES:

  • named arguments are not supported for date:add field and date are optional arguments.
  • If no field is given, then the Day -field will be used to add the with the given amount.

Example

Example

Example

toString($pattern) <String>

ToString converts date-Object into String-format, decided by the $pattern. To see the supported options in the pattern, please refer to "https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html".

Example

toMillis() <Number>

ToMillis converts the date-Object into milliseconds passed since January 1, 1970, 00:00:00 GMT, offset by the input-date Object.

Example

fromMillis() <Object>

FromMillis converts the milliseconds (Number-type) into Operon date-Object.

Example

fromString($pattern) <Object>

FromString converts the date from String-representation, decided by the $pattern into an Operon date-Object. To see the supported options in the pattern, please refer to "https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html".

Example