- date = clock.currentDate()
- date = clock.newDate(year, month, day)
- date = clock.newDate(str)
SYNOPSIS
DESCRIPTION
Both functions create a new date instance. clock.currentDate() initializes the instance from the current system date, while clock.newDate() initializes from an arbitrary value.
Particularly, the third form takes a string str encoded in ISO8601 format "YYYY-MM-DD". This is the same format as returned by tostring(date).
RETURN VALUE
Returns a new date instance.
NOTES
The system clock runs in the UTC date zone. If you need the local date, please use
clock.newDateTime() and convert to local date using datetime:toLocal().
EXAMPLE
>
>
d = clock.newDate(1989,11,9)
print (d)
1989-11-09
>
>
d = clock.newDate("1989-11-09")
print(d:year(), d:month(), d:day())
1989 11 9