Home Contents | # tostring(datetime) | Date/Time | Core4 Lua Commands

## SYNOPSIS

str = tostring(datetime)

## DESCRIPTION

A datetime in string context returns the datetime formatted as per ISO 8601 extended format.

## RETURN VALUE

A string formatted as "YYYY-MM-DDTHH:MM:SS". If datetime is not valid, returns the string "????-??-??T??:??:??".

## ERRORS

Raises an error if datetime is not a datetime instance.

## EXAMPLE

> >
d = clock.currentDatetime() print (d)
2009-08-06T10:22:42

## SEE ALSO

clock.currentDateTime, clock.newDateTime, clock.setDateTime, clock.tzget, clock.tzset, datetime(), datetime:addDays, datetime:addMonths, datetime:addSecs, datetime:addYears, datetime:base90, datetime:toTime_t, 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:set, datetime:setBase90, datetime:setTime_t, datetime:time, datetime:toLocal, datetime:toUTC, datetime:year, datetime:zone