OpenWGA 7.10 - TMLScript reference

WGA
Object:

WGA.Date([otherDate])
WGA.Date(dateString, formatString[, language])

Description

Creates a WGADate Object.

Available since version 7.10.1

Retrieval WGA.Date()

Without parameter the date object is initialised with the current system date and time.

The date object can optionally be initialised with another date object:

WGA.Date(otherDate)

Alternatively the object can be initialised with a date string together with a format string:

WGA.Date("01.01.2020", "dd.MM.yyyy")

Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Inherits from object Date
Properties and methods
Name Purpose
after(date) inherited Tests if the current date is after the parameter date
before(date) inherited Tests if the current date is before the parameter date
dateOnly()

Removes all daytime information from a date and returns the resulting date as WGADate object for further method chaining.

diff(otherDate, unit)

Calculates the difference between this date and another date and return the result based on the given unit.

format(format[, language])

Formats a date and returns a string.

isDateInFuture()

Calculates if this date is in the future.

isDateInPast()

Calculates if this date is in the past.

modify(unit, amount)

Modifies the date and returns the resulting date as WGADate object for further method chaining.

time inherited Returns the stored timepoint as number
Examples
WGA.Date("25.06.2020", "dd.MM.yyyy")
.modify("d", 10)
.dateOnly()
// returns Sun Jul 05 00:00:00 CEST 2020