1STRPTIME(1) User Commands STRPTIME(1)
2
3
4
6 strptime - Parse input from stdin according to one of the given formats
7 FORMATs.
8
10 strptime [OPTION]... [INPUT]...
11
13 Parse input from stdin according to one of the given formats FORMATs.
14 The format string specifiers are the same as for strptime(3).
15
16
17 Recognized OPTIONs:
18
19 -h, --help
20 Print help and exit
21
22 -V, --version
23 Print version and exit
24
25 -t, --time
26 also display time in the output, default is to display the date
27
28 -q, --quiet
29 Suppress message about date/time and duration parser errors.
30
31 -f, --format=STRING
32 Output format. This can either be a specifier string (similar
33 to strftime()'s FMT) or the name of a calendar.
34
35 -i, --input-format=STRING...
36 Input format, can be used multiple times. Each date/time will
37 be passed to the input format parsers in the order they are
38 given, if a date/time can be read successfully with a given
39 input format specifier string, that value will be used.
40
41 -e, --backslash-escapes
42 Enable interpretation of backslash escapes in the output and
43 input format specifier strings.
44
45 -l, --locale
46 Make internal strptime(3) and strftime(3) behave in a locale
47 dependent way, default is to pretend LC_ALL=C is in place.
48
50 Format specs in dateutils are similar to posix' strftime().
51
52 However, due to a broader range of supported calendars dateutils must
53 employ different rules.
54
55 Date specs:
56 %a The abbreviated weekday name
57 %A The full weekday name
58 %_a The weekday name shortened to a single character (MTWRFAS)
59 %b The abbreviated month name
60 %B The full month name
61 %_b The month name shortened to a single character (FGHJKMNQUVXZ)
62 %c The count of the weekday within the month (range 00 to 05)
63 %C The count of the weekday within the year (range 00 to 53)
64 %d The day of the month, 2 digits (range 00 to 31)
65 %D The day of the year, 3 digits (range 000 to 366)
66 %F Equivalent to %Y-%m-%d (ymd's canonical format)
67 %g ISO week date year without the century (range 00 to 99)
68 %G ISO week date year including the century
69 %j Equivalent to %D
70 %m The month in the current calendar (range 00 to 19)
71 %Q The quarter of the year (range Q1 to Q4)
72 %q The number of the quarter (range 01 to 04)
73 %s The number of seconds since the Epoch.
74 %u The weekday as number (range 01 to 07, Sunday being 07)
75 %U The week count, day of week is Sun (range 00 to 53)
76 %V The ISO week count, day of week is Mon (range 01 to 53)
77 %w The weekday as number (range 00 to 06, Sunday being 00)
78 %W The week count, day of week is Mon (range 00 to 53)
79 %y The year without a century (range 00 to 99)
80 %Y The year including the century
81 %_y The year shortened to a single digit
82 %Z The zone offset in hours and minutes (HH:MM) with
83 a preceding sign (+ for offsets east of UTC, - for offsets
84 west of UTC)
85
86 %Od The day as roman numerals
87 %Om The month as roman numerals
88 %Oy The two digit year as roman numerals
89 %OY The year including the century as roman numerals
90
91 %rs In time systems whose Epoch is different from the unix Epoch, this
92 selects the number of seconds since then.
93 %rY In calendars with years that don't coincide with the Gregorian
94 years, this selects the calendar's year.
95
96 %dth The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
97 %mth The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
98
99 %db The business day of the month (since last month's ultimo)
100 %dB Number of business days until this month's ultimo
101
102 Time specs:
103 %H The hour of the day using a 24h clock, 2 digits (range 00 to 23)
104 %I The hour of the day using a 12h clock, 2 digits (range 01 to 12)
105 %M The minute (range 00 to 59)
106 %N The nanoseconds (range 000000000 to 999999999)
107 %p The string AM or PM, noon is PM and midnight is AM.
108 %P Like %p but in lowercase
109 %S The (range 00 to 60, 60 is for leap seconds)
110 %T Equivalent to %H:%M:%S
111
112 General specs:
113 %n A newline character
114 %t A tab character
115 %% A literal % character
116
117 Modifiers:
118 %O Modifier to turn decimal numbers into Roman numerals
119 %r Modifier to turn units into real units
120 %0 Modifier to turn on zero prefixes
121 %SPC Modifier to turn on space prefixes
122 %- Modifier to turn off prefixes altogether
123 th Suffix, read and print ordinal numbers
124 b Suffix, treat days as business days
125
126 By design dates before 1601-01-01 are not supported.
127
128 For conformity here is a list of calendar designators and their correā
129 sponding format string:
130 ymd %Y-%m-%d
131 ymcw %Y-%m-%c-%w
132 ywd %rY-W%V-%u
133 bizda %Y-%m-%db
134 lilian n/a
135 ldn n/a
136 julian n/a
137 jdn n/a
138 matlab n/a
139 mdn n/a
140
141 These designators can be used as output format string, moreover,
142 @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used
143 as input format string.
144
145
147 $ strptime -i '%a, %b-%d/%Y' 'Mon, May-01/2000'
148 2000-05-01
149 $
150
151 $ strptime -i '%a, %b-%d/%Y' <<EOF
152 Mon, May-01/2000
153 Mon, Mar-2/2000
154 EOF
155 2000-05-01
156 2000-03-02
157 $
158
160 Written by Sebastian Freundt <freundt@fresse.org>
161
163 Report bugs to: https://github.com/hroptatyr/dateutils/issues
164
166 The full documentation for strptime is maintained as a Texinfo manual.
167 If the info and strptime programs are properly installed at your site,
168 the command
169
170 info (dateutils)strptime
171
172 should give you access to the complete manual.
173
174
175
176dateutils 0.4.7 February 2020 STRPTIME(1)