1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
Date
====
Date is used to retrieve current date and time. You can access this object simply by typing `Date`.
Example:
```
// What day is today?
object "Application"
{
// show the day
state "main"
{
today = Date.year + "-" + f(Date.month) + "-" + f(Date.day);
Console.print("Today is " + today);
Application.exit();
}
// add a leading zero
fun f(x)
{
if(x >= 10)
return x;
else
return "0" + x;
}
}
```
*Available since:* SurgeScript 0.5.2
Properties
----------
#### year
`year`: number, read-only.
The current year.
#### month
`month`: number, read-only.
Month of the year (1-12).
#### day
`day`: number.
Day of the month (1-31).
#### hour
`hour`: number.
Hours since midnight (0-23).
#### minute
`minute`: number.
Minutes after the hour (0-59).
#### second
`second`: number.
Seconds after the minute (0-59).
#### weekday
`weekday`: number.
Days since Sunday (0-6).
#### unixtime
`unixtime`: number.
Number of seconds since Jan 1st, 1970 00:00:00 UTC.
Functions
---------
#### timezoneOffset
`timezoneOffset()`
The difference, in minutes, from the Coordinated Universal Time (UTC) to the timezone of the host. Example: if your timezone is UTC-03:00, this function returns -180.
*Available since:* SurgeScript 0.5.2
*Returns*
The timezone difference in minutes.
#### toString
`toString()`
Converts the current date and time to a string. The string is formatted according to the ISO 8601 standard.
*Available since:* SurgeScript 0.5.2
*Returns*
The current date and time expressed according to ISO 8601.
|