User`s guide
APPENDIX A Function Reference
User’s Guide 139
The “unixepoch” modifier (12) works only if it immediately follows a time
string in the DDDD.DDDDD format. This modifier causes the
DDDD.DDDDD to be interpreted not as a Julian day number as it normally
would be, but as the number of seconds since 1970. This modifier allows unix-
based times to be converted to Julian day numbers easily. The “localtime”
modifier (13) adjusts the previous time string so that it displays the correct
local time. “utc” undoes this.
The “Julian” modifier (14) assumes that the time string is a Gregorian date and
converts the date into a Julian date: “Gregorian” undoes the work of “Julian.”
Date and time calculations
Compute the current date:
uDate('now')
Compute the last day of the current month.
uDate('now','start of month','+1 month','-1 day')
Compute the date and time given a UNIX timestamp 1092941466:
uDatetime(1092941466, 'unixepoch')
Compute the date and time given a UNIX timestamp 1092941466, and
compensate for your local timezone.
uDatetime(1092941466, 'unixepoch', ‘localtime’)
Compute the current UNIX timestamp:
strftime('%s','now')
Compute the number of days since the Battle of Hastings:
uJuliandate('now') - uJuliandate('1066-10-14','gregorian')
Compute the number of seconds between two dates:
julianday('now')*86400 - julianday('2004-01-01 02:34:56')*86400
Compute the date of the first Tuesday in October (January + 9) for the current
year:
date('now','start of year','+9 months','weekday 2')
Known limitations
• The computation of local time depends heavily on the whim of local
politicians and as a result, is difficult to get correct for all locales. In this
implementation, the standard C library function
localtime() is used to assist
in the calculation of local time.