The Date object is used to represent a given date and time in a script. You must create a new Date object in the script before you can use the Date functions. There are four methods of assigning a new instance of a date
In this instance myDate will be set to the current date and time on your PC, for example, " Wed 21 November 2001 13:20:10". This is the most commonly used method.
var myDate = new Date()
In this instance myDate will be set to "31 January 2000 00:20:00", which is the number of milliseconds that have passed since Midnight 1/1/1970.
var myDate = new Date(949278000000)
In this instance, the date and time is entered as a string. You may enter just the date if the time is not required.
var myDate = new Date("Wed 21 November 2001, 13:20:10")
In this instance, the date and time is entered as individual values in the following order: Year, Month, Day, Hour, Minute. Each of the values can either be a number or a variable containing a number. In this example, the date is 31 Dec 2001 08:00:00 (
The month January is entered as the number 0 and the month December is 11.
var mydate = new Date(2001,11,31,8,0)
Once you have created a new Date object in your script, you can use Get actions to retrieve the current date set in the Date object
var date = myDate.getDate()
Alternatively, once you have created a new Date object in your script, you can use the Set actions to place a new date in the Date object
var setDate = myDate.setDate(10)
Hierarchy:
Only the specific functions listed under the Functions: heading below can be used with Date objects:
Class Hierarchy:
Date
Functions:
Return the number of milliseconds since 1/1/1970 | |
Return the day of the month | |
Return the day of the week | |
Return the year | |
Return the hour | |
Return the number of milliseconds | |
Return the minutes | |
Return the month | |
Return the seconds | |
Return the number of milliseconds since 1/1/1970 | |
Return the difference between local time zone and universal time in minutes | |
Return the day of the month in universal time | |
Return the day of the week in universal time | |
Return the year in universal time | |
Return the hour in universal time | |
Return the number of milliseconds in universal time | |
Return the minutes in universal time | |
Return the month in universal time | |
Return the seconds in universal time | |
Set the day of the month | |
Sets the year | |
Sets the hour | |
Sets the number of milliseconds | |
Sets the minutes | |
Sets the month | |
Sets the seconds | |
Sets the time since 1/1/1970 in milliseconds | |
Sets the date in the month in universal time | |
Sets the full year in universal time | |
Sets the hour in universal time | |
Sets the number of milliseconds in universal time | |
Sets the number of minutes in universal time | |
Sets the month in universal time | |
Sets the seconds in universal time | |
Converts the Date object to a string adjusted to GMT (Greenwich Mean Time) | |
Converts the Date object to a string adjusted to local time zone | |
Converts the Date object into a string | |
Converts the Date object into a string adjusted to universal time | |
Return the value of the Date object as a number of milliseconds |