Lynxer

Documentation

time

Date and time helpers.

Backend: native — stdlib/time.so, built from stdlib/time.cpp over <chrono> and <ctime>. Import: import("time") → global.time.*

FunctionSignatureNotes
now() -> strYYYY-MM-DD HH:MM:SS local time
getTime() -> strHH:MM:SS
getDate() -> strYYYY-MM-DD
isoNow() -> strYYYY-MM-DDTHH:MM:SS
format(str pattern) -> strstrftime with the current local time
fromTimestamp(float value) -> strFormats a Unix timestamp as YYYY-MM-DD HH:MM:SS
toTimestamp(str value) -> floatParses YYYY-MM-DD[ HH:MM:SS]; -1.0 on error
addDays(str date, int days) -> strAdds days to a YYYY-MM-DD date; "" on error
diffDays(str left, str right) -> intWhole days from left to right
timestamp() -> floatCurrent Unix time
getYear … getSecond() -> intLocal clock fields
getWeekdayNum() -> intWeekday number, Monday = 0
getWeekday() -> strFull weekday name, e.g. Wednesday
isLeapYear(int year) -> boolLeap-year test
daysInMonth(int year, int month) -> int0 for an out-of-range month

Example

global setup(){ import("time"); }

global main(){
    println(global.time.getDate());
    println(global.time.addDays("2026-02-27", 2));
    println(global.time.daysInMonth(2024, 2));
}

See also