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 -S, --sed-mode
46 Copy parts from the input before and after a matching date/time.
47 Note that all occurrences of date/times within a line will be
48 processed.
49
50 -l, --locale
51 Make internal strptime(3) and strftime(3) behave in a locale
52 dependent way, default is to pretend LC_ALL=C is in place.
53
55 Format specs in dateutils are similar to posix' strftime().
56
57 However, due to a broader range of supported calendars dateutils must
58 employ different rules.
59
60 Date specs:
61 %a The abbreviated weekday name
62 %A The full weekday name
63 %_a The weekday name shortened to a single character (MTWRFAS)
64 %b The abbreviated month name
65 %B The full month name
66 %_b The month name shortened to a single character (FGHJKMNQUVXZ)
67 %c The count of the weekday within the month (range 00 to 05)
68 %C The count of the weekday within the year (range 00 to 53)
69 %d The day of the month, 2 digits (range 00 to 31)
70 %D The day of the year, 3 digits (range 000 to 366)
71 %F Equivalent to %Y-%m-%d (ymd's canonical format)
72 %g ISO week date year without the century (range 00 to 99)
73 %G ISO week date year including the century
74 %j Equivalent to %D
75 %m The month in the current calendar (range 00 to 19)
76 %Q The quarter of the year (range Q1 to Q4)
77 %q The number of the quarter (range 01 to 04)
78 %s The number of seconds since the Epoch.
79 %u The weekday as number (range 01 to 07, Sunday being 07)
80 %U The week count, day of week is Sun (range 00 to 53)
81 %V The ISO week count, day of week is Mon (range 01 to 53)
82 %w The weekday as number (range 00 to 06, Sunday being 00)
83 %W The week count, day of week is Mon (range 00 to 53)
84 %y The year without a century (range 00 to 99)
85 %Y The year including the century
86 %_y The year shortened to a single digit
87 %Z The zone offset in hours and minutes (HH:MM) with
88 a preceding sign (+ for offsets east of UTC, - for offsets
89 west of UTC)
90
91 %Od The day as roman numerals
92 %Om The month as roman numerals
93 %Oy The two digit year as roman numerals
94 %OY The year including the century as roman numerals
95
96 %rs In time systems whose Epoch is different from the unix Epoch, this
97 selects the number of seconds since then.
98 %rY In calendars with years that don't coincide with the Gregorian
99 years, this selects the calendar's year.
100
101 %dth The day of the month as an ordinal number, 1st, 2nd, 3rd, etc.
102 %mth The month of the year as an ordinal number, 1st, 2nd, 3rd, etc.
103
104 %db The business day of the month (since last month's ultimo)
105 %dB Number of business days until this month's ultimo
106
107 Time specs:
108 %H The hour of the day using a 24h clock, 2 digits (range 00 to 23)
109 %I The hour of the day using a 12h clock, 2 digits (range 01 to 12)
110 %M The minute (range 00 to 59)
111 %N The nanoseconds (range 000000000 to 999999999)
112 %p The string AM or PM, noon is PM and midnight is AM.
113 %P Like %p but in lowercase
114 %S The (range 00 to 60, 60 is for leap seconds)
115 %T Equivalent to %H:%M:%S
116
117 General specs:
118 %n A newline character
119 %t A tab character
120 %% A literal % character
121
122 Modifiers:
123 %O Modifier to turn decimal numbers into Roman numerals
124 %r Modifier to turn units into real units
125 %0 Modifier to turn on zero prefixes
126 %SPC Modifier to turn on space prefixes
127 %- Modifier to turn off prefixes altogether
128 th Suffix, read and print ordinal numbers
129 b Suffix, treat days as business days
130
131 By design dates before 1601-01-01 are not supported.
132
133 For conformity here is a list of calendar designators and their correā
134 sponding format string:
135 ymd %Y-%m-%d
136 ymcw %Y-%m-%c-%w
137 ywd %rY-W%V-%u
138 bizda %Y-%m-%db
139 lilian n/a
140 ldn n/a
141 julian n/a
142 jdn n/a
143 matlab n/a
144 mdn n/a
145
146 These designators can be used as output format string, moreover,
147 @code{lilian}/@code{ldn} and @code{julian}/@code{jdn} can also be used
148 as input format string.
149
150
152 $ strptime -i '%a, %b-%d/%Y' 'Mon, May-01/2000'
153 2000-05-01
154 $
155
156 $ strptime -i '%a, %b-%d/%Y' <<EOF
157 Mon, May-01/2000
158 Mon, Mar-2/2000
159 EOF
160 2000-05-01
161 2000-03-02
162 $
163
165 Written by Sebastian Freundt <freundt@fresse.org>
166
168 Report bugs to: https://github.com/hroptatyr/dateutils/issues
169
171 The full documentation for strptime is maintained as a Texinfo manual.
172 If the info and strptime programs are properly installed at your site,
173 the command
174
175 info (dateutils)strptime
176
177 should give you access to the complete manual.
178
179
180
181dateutils 0.4.4 August 2018 STRPTIME(1)