Module jls.util.Date
Provide a simple Date class.
Class Date
Date:new (yearOrTime[, month[, day[, hour[, min[, sec[, ms]]]]]]) | Creates a new Date. |
date:getYear () | Returns the year of this date. |
date:getMonth () | Returns the year of this date. |
date:getDay () | Returns the year of this date. |
date:getWeekDay () | Returns the year of this date. |
date:getHours () | Returns the year of this date. |
date:getMinutes () | Returns the year of this date. |
date:getSeconds () | Returns the year of this date. |
date:getMilliseconds () | Returns the year of this date. |
date:getTime () | Returns the number of milliseconds since epoch, 1970-01-01T00:00:00 UTC, represented by this date. |
date:compareTo (date) | Compares the specified date to this date. |
Date.now () | Returns the number of milliseconds since epoch, 1970-01-01T00:00:00 UTC. |
Class Date
The Date class.
The Date provides a way to manipulate date and time.
The Date represents the number of milliseconds since epoch, 1970-01-01T00:00:00 UTC.
- Date:new (yearOrTime[, month[, day[, hour[, min[, sec[, ms]]]]]])
-
Creates a new Date.
Parameters:
- yearOrTime number the year or the time in milliseconds.
- month number the month (optional)
- day number the day (optional)
- hour number the hour (optional)
- min number the min (optional)
- sec number the sec (optional)
- ms number the ms (optional)
Returns:
-
a new Date
Usage:
Date:new(2017, 12, 4, 0, 1, 18) or Date:new(2017, 12) Date:new() or Date:new(1512345678000)
- date:getYear ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getMonth ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getDay ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getWeekDay ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getHours ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getMinutes ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getSeconds ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getMilliseconds ()
-
Returns the year of this date.
Returns:
-
number
the year.
- date:getTime ()
-
Returns the number of milliseconds since epoch, 1970-01-01T00:00:00 UTC, represented by this date.
Returns:
-
number
the number of milliseconds since epoch
- date:compareTo (date)
-
Compares the specified date to this date.
Parameters:
- date the date to compare to
Returns:
-
number
0 if the dates are equals, less than 0 if this date is before the specified date, more than 0 if this date is after the specified date
- Date.now ()
-
Returns the number of milliseconds since epoch, 1970-01-01T00:00:00 UTC.
Returns:
-
number
the number of milliseconds since epoch