1 .\" $NetBSD: parsedate.3,v 1.4 2008/04/30 13:10:52 martin Exp $
3 .\" Copyright (c) 2006 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Christos Zoulas.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd date parsing function
41 .Fn parsedate "const char *datestr" "const time_t *time" "const int *tzoff"
45 function parses a datetime from
47 described in english relative to an optional
49 point and an optional timezone offset in seconds specified in
57 then the current time and timezone offset are used.
61 is a sequence of white-space separated items.
62 The white-space is optional the concatenated items are not ambiguous.
65 is equivalent to midnight today (the beginning of this day).
67 The following words have the indicated numeric meanings:
75 is unused so that it is not confused with
98 The following words are recognized in English only:
119 The days of the week:
197 A variety of unambiguous dates are recognized:
198 .Bl -tag -compact -width "20 Jun 1994"
200 For years between 69-99 we assume 1900+ and for years between 0-68
205 October 10, 2000; the common US format.
209 Other common abbreviations.
211 the year can be omitted
215 .Bl -tag -compact -width 12:11:01.000012
222 Relative items are also supported:
223 .Bl -tag -compact -width "this thursday"
233 returns the number of seconds passed since the Epoch, or
235 if the date could not be parsed properly.
242 was originally written by Steven M. Bellovin while at the University
243 of North Carolina at Chapel Hill.
244 It was later tweaked by a couple of people on Usenet.
245 Completely overhauled by Rich $alz and Jim Berets in August, 1990.
249 function first appeared in