MongooseWhere programmers kick back and build silly things together.

All help topics · Link to this topic

Showing help on '$time_utils'

time utilities ($time_utils #43)

Converting from seconds-since-1970
dhms (time) => string ...DD:HH:MM:SS
english_time (time[, reference time)=> string of y, m, d, h, m, s

Converting to seconds
to_seconds ("hh:mm:ss") => seconds since 00:00:00
from_ctime (ctime) => corresponding time-since-1970
from_day (day_of_week, which) => time-since-1970 for the given day*
from_month (month, which) => time-since-1970 for the given month*
(* the first midnight of that day/month)
parse_english_time_interval("n1 u1 n2 u2...")
=> seconds in interval
seconds_until_time("hh:mm:ss") => number of seconds from now until then
seconds_until_date("month",day,"hh:mm:ss",flag
=> number of seconds from now until then
(see verb help for details)

Converting to some standard English formats
day ([c]time) => what day it is
month ([c]time) => what month it is
ampm ([c]time[, precision]) => what time it is, with am or pm
mmddyy ([c]time) => date in format MM/DD/YY
ddmmyy ([c]time) => date in format DD/MM/YY

Substitution
time_sub (string, time) => substitute time information

Miscellaneous
sun ([time]) => angle between sun and zenith
dst_midnight (time)

:to_seconds - Given string hh:mm:ss ($string_utils:explode(ctime(time))[4]), this returns
:from_ctime - Given a string such as returned by ctime(), return the corresponding time-in-seconds-since-1970 time returned by time(), or E_DIV if the format is wrong in some essential way.
:english_time - english_time(time [,reference time]): returns the time as a string of
:from_day - from_day(day_of_week,which)
:from_month - from_month(month,which[,d])
:dst_midnight - Takes a time that is midnight PST and converts it to the nearest PDT midnight time if it's during that part of the year where we use PDT.
:time_sub - Works like pronoun substitution, but substitutes time stuff.
:mmddyy - Given a time() or ctime()-style date and an optional separator, this returns the MM/DD/YY or DD/MM/YY form of the date (depending on the verb called.) The default seperator is '/'
:parse_english_time_interval - $time_utils:parse_english_time_interval(n1,u1,n2,u2,...)
:seconds_until_date(month,day,time,which)
:seconds_until_time(hh:mm:ss)
:rfc822_ctime - Just like ctime(), but rfc-822 compliant.
:mmddyyyy - Given a time() or ctime()-style date and an optional separator, this returns the MM/DD/YYYY or DD/MM/YYYY form of the date (depending on the verb called.) The default seperator is '/'
:RFC2616 - returns time according to RFC2616 used often in http headers
:isoformat - return time in ISO 8601 format
:from_isoformat - Given a string such as returned by isoformat(), return the corresponding time-in-seconds-since-1970 time returned by time(), or E_DIV if the format is wrong in some essential way.
:_ts_to_date - Convert a timestamp to YYYY-MM-DD string.
:parse_natural_date - Parse flexible date input.
:parse_natural_time - Parse flexible time input.

Also from $generic_utils: 1 documented verb. help $generic_utils