OpenWGA 7.7 - TMLScript reference
WGAMethod :
createCalendar([date])
On object | WGA |
Usage |
Creates a Java Calendar object offering diverse functionality to modify date values |
Description |
The Calendar object takes date/time information from a date object and offers methods to modify it on a single field basis. The result of the modification is stored inside the Calendar object until you use method getTime() to again return a real Date object that presents the modified dates. The Calendar object is part of the Java API, and therefor entirely documented on the JavaSE API Documentation. However the methods mostly used on this object are: Calendar.add(fieldConstant, value) Modifies a single field of the date/time. You must determine the value to modifiy as a constant, that you can retrieve from the Calendar object itself. The most frequently used field constants are: Calendar.MINUTE Calendar.HOUR_OF_DAY (24 hours day) Calendar.DAY_OF_MONTH Calendar.MONTH Calendar.YEAR Calendar.WEEK_OF_YEAR The value to add to the field can be positive or negative. The calendar watches for integrity of the represented date value. If you add a number to a single field that makes it larger as possible it also increases the next higher field. For example adding 5 days to a date of May the 31th will result in June the 5th. Calendar.getTime() Returns the modified value again as a date object which you can continue to use in TMLScript. For backward compatibility there still is a method "createCalendar()" available on TMLContext whose use is discouraged since OpenWGA 5.3. |
Parameters |
date (Date, optional): A date object to be modified. If omitted the calendar will be initialized with the current date/time. |
Return value | Java-Objekt vom Typ java.util.Calendar. |
Allowed in script types |
|
Examples |
Following example creates a calendar based on a Date, subtracts 5 days from it and returns the modified date as Date object.var calendar = WGA.createCalendar(anotherDate); |