Home Contents | # datetime:set | Date/Time | Core4 Lua Commands

## SYNOPSIS

datetime:set(year, [month, [day, [hour [, minute[, second[, millisecond]]]]]])

## DESCRIPTION

Changes the stored date/time value. Values that are not specified or passed as nil are not changed.

## ERRORS

Raises an error if datetime is not a datetime instance.

## EXAMPLE

> >
dt = clock.newDateTime(2033, 05, 18, 3, 33, 20) print(dt)
2033-05-18T03:33:20
> >
dt:set(nil, 1, 1) print(dt)
2033-01-01T03:33:20

## SEE ALSO

clock.currentDateTime, clock.newDateTime, clock.setDateTime, clock.tzget, clock.tzset, datetime(), datetime:addDays, datetime:addMonths, datetime:addSecs, datetime:addYears, datetime:base90, datetime:date, datetime:day, datetime:daysTo, datetime:format, datetime:hour, datetime:isNull, datetime:isValid, datetime:isdst, datetime:minute, datetime:month, datetime:msec, datetime:offset, datetime:second, datetime:secsTo, datetime:setBase90, datetime:time, datetime:toLocal, datetime:toUTC, datetime:year, datetime:zone, tostring(datetime)