chiark / gitweb /
use libinn logging where applicable - debugged
[inn-innduct.git] / doc / pod / convdate.pod
1 =head1 NAME
2
3 convdate - Convert time/date strings and numbers
4
5 =head1 SYNOPSIS
6
7 B<convdate> [B<-dhl>] [B<-c> | B<-n> | B<-s>] [I<date> ...]
8
9 =head1 DESCRIPTION
10
11 B<convdate> translates the date/time strings given on the command line,
12 outputting the results one to a line.  The input can either be a date in
13 some format that parsedate(3) can parse or the number of seconds since
14 epoch (if B<-c> is given).  The output is either ctime(3) results, the
15 number of seconds since epoch, or a Usenet Date: header, depending on the
16 options given.
17
18 =head1 OPTIONS
19
20 =over 4
21
22 =item B<-c>
23
24 Each argument is taken to be the number of seconds since epoch (a time_t)
25 rather than a date.
26
27 =item B<-d>
28
29 Output a valid Usenet Date: header instead of the results of ctime(3) for
30 each date given on the command line.  This is useful for testing the
31 algorithm used to generate Date: headers for local posts.  Normally, the
32 date will be in UTC, but see the B<-l> option.
33
34 =item B<-h>
35
36 Print usage information and exit.
37
38 =item B<-l>
39
40 Only makes sense in combination with B<-d>.  If given, Date: headers
41 generated will use the local time zone instead of UTC.
42
43 =item B<-n>
44
45 Rather than outputting the results of ctime(3) or a Date: header, output
46 each date given as the number of seconds since epoch (a time_t).  This
47 option doesn't make sense in combination with B<-d>.
48
49 =item B<-s>
50
51 Pass each given date to parsedate(3) and print the results of ctime(3) (or
52 a Date: header if B<-d> is given).  This is the default behavior.
53
54 =back
55
56 =head1 EXAMPLES
57
58 Note that relative times or times with partial information use the current
59 time to fill in the rest of the date, so dates like "12pm" are taken to be
60 12pm of the day when convdate is run.  This is a property of parsedate(3);
61 see the man page for more information.  Most of these examples are from
62 the original man page dating from 1991 and were run in the -0400 time
63 zone.
64
65     % convdate 'feb 10 10am'
66     Sun Feb 10 10:00:00 1991
67
68     % convdate 12pm 5/4/90
69     Fri Dec 13 00:00:00 1991
70     Fri May  4 00:00:00 1990
71
72 Note that 12pm and 5/4/90 are two *separate* arguments and therefore
73 result in two results.  Note also that a date with no time is taken to be
74 at midnight.
75
76     % convdate -n 'feb 10 10am' '12pm 5/4/90'
77     666198000
78     641880000
79
80     % convdate -c 666198000
81     Sun Feb 10 10:00:00 1991
82
83 ctime(3) results are in the local time zone.  Compare to:
84
85     % convdate -dc 666198000
86     Sun, 10 Feb 1991 15:00:00 +0000 (UTC)
87
88     % env TZ=PST8PDT convdate -dlc 666198000
89     Sun, 10 Feb 1991 07:00:00 -0800 (PST)
90
91     % env TZ=EST5EDT convdate -dlc 666198000
92     Sun, 10 Feb 1991 10:00:00 -0500 (EST)
93
94 The system library functions generally use the environment variable TZ to
95 determine (or at least override) the local time zone.
96
97 =head1 HISTORY
98
99 Written by Rich $alz <rsalz@uunet.uu.net>, rewritten and updated by Russ
100 Allbery <rra@stanford.edu> for the B<-d> and B<-l> flags.
101
102 $Id: convdate.pod 3362 2000-06-13 02:57:51Z rra $
103
104 =head1 SEE ALSO
105
106 parsedate(3).