OpenWGA 7.11 - TMLScript reference

Method :

parseDate(date, format [, language])

On object WGA
Usage Converts a string containing date/time information to a date object.

DEPRECATED since 7.10.1. Use WGA.Date(date, format, language) instead.

Description This method parses the given string based on a custom date format and return it as date object. You must specify the date format that the string contains in parameter "format" using the same syntax described on WebTML attribute format for date output.

If the string is unparseable for the given date format the method will throw a JavaScript error wrapping a Java exception of type java.text.ParseException.

For backward compatibility there still is a method "parseDate()" available on TMLContext whose use is discouraged since OpenWGA 5.3.

Parameters date (String):
String containing date/time values in a special format

format (String):
String containing the format in which the date/time value is given. See WebTML attribute format for the syntax how to specify it.

language (String, optional):
A language string determining the language for language dependent formattings. Omit to let OpenWGA language behaviour choose the language.

Return value A date object holding the date/time value that was represented by the string
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples Creating a date object holding the date of March the 12th 1999:

var aDate = WGA.parseDate("12.03.1999", "dd.MM.yyyy");