PARSEDATE(3) | Library Functions Manual | PARSEDATE(3) |
time_t
parsedate(const char *datestr, const time_t *time, const int *tzoff);
The datestr is a sequence of white-space separated items. The white-space is optional the concatenated items are not ambiguous. An empty datestr is equivalent to midnight today (the beginning of this day).
The following words have the indicated numeric meanings: last = -1, this = 0, first, next, or one = 1, second is unused so that it is not confused with “seconds”, two = 2, third or three = 3, fourth or four = 4, fifth or five = 5, sixth or six = 6, seventh or seven = 7, eighth or eight = 8, ninth or nine = 9, tenth or ten = 10, eleventh or eleven = 11, twelfth or twoelve = 12.
The following words are recognized in English only: AM, PM, a.m., p.m.
The months: january, february, march, april, may, june, july, august, september, sept, october, november, december,
The days of the week: sunday, monday, tuesday, tues, wednesday, wednes, thursday, thur, thurs, friday, saturday.
Time units: year, month, fortnight, week, day, hour, minute, min, second, sec, tomorrow, yesterday.
Timezone names: gmt, ut, utc, wet, bst, wat, at, ast, adt, est, edt, cst, cdt, mst, mdt, pst, pdt, yst, ydt, hst, hdt, cat, ahst, nt, idlw, cet, met, mewt, mest, swt, sst, fwt, fst, eet, bt, zp4, zp5, zp6, wast, wadt, cct, jst, east, eadt, gst, nzt, nzst, nzdt, idle.
A variety of unambiguous dates are recognized:
As well as times:
Relative items are also supported:
Seconds since epoch (also known as UNIX time) are also supported:
The parsedate() function first appeared in NetBSD 4.0.
December 20, 2010 | NetBSD 6.1 |