Time builtins
11 builtins of Soma 3.2.4 in the category Time, with their exact signatures, as soma describe --builtins --json prints them.
parse_date
parse_date(s: "YYYY-MM-DD") -> {year, month, day, weekday, epoch_day}Strict ISO date to its parts (weekday 1 = Monday); raises kind "date" otherwise.
add_days
add_days(date: String, n: Int) -> StringThe ISO date n days later (negative n goes back), across month and year ends.
add_months
add_months(date: String, n: Int) -> StringSame day n months later, clamped to the month's length (Ruby's Date >> n): add_months("2026-01-31", 1) = "2026-02-28".
days_between
days_between(a: String, b: String) -> IntDays from a to b (negative when b is earlier).
months_between
months_between(a: String, b: String) -> IntWhole months from a to b ("YYYY-MM-DD"), day-of-month aware like java.time MONTHS.between: 2026-01-15 → 2026-04-14 is 2, → 2026-04-20 is 3.
days_in_month
days_in_month(year: Int, month: Int) -> Int28–31, leap years included.
now
now() -> IntCurrent Unix timestamp in seconds.
Used in verified programs:
- web/guestbook, line 19: let entry = map("name", escape_html(name), "message", escape_html(message), "at", now())
now_ms
now_ms() -> IntCurrent Unix timestamp in milliseconds.
today
today() -> StringToday's date as "YYYY-MM-DD" (UTC).
Used in verified programs:
- services/refund_agent, line 58: on paid_today() { return paid_by_day.get(today()) ?? 0 }
format_date
format_date(ts: Int) -> StringFormat a Unix-seconds timestamp as "YYYY-MM-DD" (UTC).
sleep
sleep(ms: Int) -> ()Block the current handler for ms milliseconds. Requires one Int (other types raise kind type); values outside 0 to 86400000 raise kind range. Under serve it holds the handler lock the whole time.