1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
|
.\" Copyright 1993 Mitchum DSouza <m.dsouza@mrc-apu.cam.ac.uk>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" Modified, jmv@lucifer.dorms.spbu.ru, 1999-11-08
.\" Modified, aeb, 2000-04-07
.\" Updated from glibc docs, C. Scott Ananian, 2001-08-25
.\" Modified, aeb, 2001-08-31
.\" Modified, wharms 2001-11-12, remark on white space and example
.\"
.\" Japanese Version Copyright (c) 1998 SHOJI Yasushi all rights reserved.
.\" Translated Fri Jun 26 1998 by SHOJI Yasushi <yashi@yashi.com>
.\" Updated & Modefied Sun Mar 7 1999 by Shouichi Saito
.\" Updated Tue Oct 10 22:29:13 JST 2000
.\" by Yuichi SATO <sato@complex.eng.hokudai.ac.jp>
.\" Updated Tue Apr 3 20:49:00 JST 2001
.\" by Yuichi SATO <ysato@h4.dion.ne.jp>
.\" Updated Thu Oct 11 10:05:36 JST 2001 by Yuichi SATO
.\" Updated Fri Dec 14 16:34:23 JST 2001 by Yuichi SATO
.\" Updated Sat Jan 5 22:17:34 JST 2002 by Yuichi SATO
.\" Updated Wed Jan 14 23:21:57 JST 2002 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
.\"
.\"WORD: modifier
.\"WORD: broken-down time ̤λ
.\"
.TH STRPTIME 3 2001-11-12 "GNU" "Linux Programmer's Manual"
.SH ̾
strptime \- ʸǤ蘆Ƥ֤ tm ¤Τλ֤Ѵ
.SH
.BR "#define _XOPEN_SOURCE" " /* glibc2 Ǥϡ줬ɬס */"
.br
.B #include <time.h>
.sp
.BI "char *strptime(const char *" s ", const char *" format ,
.BI "struct tm *" tm );
.SH
.BR strptime ()
ؿ
.BR strftime (3)
εմؿǤꡢݥ
.I s
ؤʸ֤Ѵ롣
Ѵκݤˤ
.I format
ǻꤷեޥåȤѤͤϥݥ
.I tm
ؤ
.I tm
¤Τ˼롣
.I format
ϡ
.BR scanf (3)
ǻȤƤ褦ʡ
եɥǥץȥƥʸǹƤʸǤ롣
ġΥեɥǥץ
.B %
Ȥ³ʸʤꡢ
Ԥ˥եɥǥץ֤Ƥꤹ롣
.I format
ʸ¾Ƥʸˤϡʸ˥ޥåʸʤФʤʤ
եޥåʸˤ㳰Ǥꡢ
ʸ 0 İʾζȥޥå롣
2 ĤΥեɥǥץδ֤ˤϡ
ѻʤФʤʤ
.PP
.BR strptime ()
ؿϡʸ鱦ؽ롣
Ϥ줿 3 Ĥ (ʸեޥå) ϡ˽롣
ϤեޥåʸȥޥåǤʤ硢ؿߤ롣
ĤΥեޥåʸʸϽʤ
.PP
Ѳǽʥեɥǥץʲ˵롣
(̾Ȥä) ʸޥå硢
ʸȾʸ϶̤Ӥ롣
ޥå硢 0 ĤƤʤɬɬפǤϤʤ
.TP
.B %%
ʸȤƤ
.BR %
.TP
.BR %a " ޤ " %A
ߤΥǤ̾ (ά̾ޤϴ̾)
.TP
.BR %b " ޤ " %B " ޤ " %h
ߤΥǤη̾ (ά̾ޤϴ̾)
.TP
.B %c
ߤΥǤդȻɽ
.TP
.B %C
1 ǯ (0-99)
.TP
.BR %d " ޤ " %e
(1-31)
.TP
.B %D
ա
.B %m/%d/%y
Ʊ
(ϥꥫշǡ
衼åѤǤä
.B %d/%m/%y
ȤȤƤ뤿ˡ
ꥫͰʳˤʶ路롣
ISO 8601 ʤǤ
.B %Y-%m-%d
ȤǤ롣)
.TP
.B %H
(0-23)
.TP
.B %I
12 Ǥλ (1-12)
.TP
.B %j
ǯνᤫ̻ (1-366)
.TP
.B %m
ɽη (1-12)
.TP
.B %M
ʬ (0-59)
.TP
.B %n
Ǥդζ
.TP
.B %p
AM () PM () бΡ
(: бΤʤ⤷ʤ)
.TP
.B %r
( AM PM Ȥä) 12 λ֡
POSIX Ǥ
.B %I:%M:%S %p
Ʊ
ߤΥˤ
.B LC_TIME
ѡȤ
\fIt_fmt_ampm\fP Ƥʤ硢
ư̤Ǥ롣
.TP
.B %R
.B %H:%M
Ʊ
.TP
.B %S
(0-60; 60 ϱä 61 Ǥ)
.TP
.B %t
Ǥդζ
.TP
.B %T
.B %H:%M:%S
Ʊ
.TP
.B %U
λϤޤȤǯ̻Ǥν (0-53)
1 κǽ 1 ܤκǽ롣
.TP
.B %w
0 Ȥɽ (0-6)
.TP
.B %W
λϤޤȤǯ̻Ǥν (0-53)
1 κǽη 1 ܤκǽ롣
.TP
.B %x
աեեޥåȤȤ
.TP
.B %X
λեޥåȤȤ
.TP
.B %y
1 ǯ (0-99)
ꤵʤ硢
ͤ 69-99 ϰϤΤȤ 20 ǯ (1969-1999)
ͤ 00-68 ϰϤΤȤ 21 ǯ (2000-2068) Ȥ롣
.TP
.B %Y
ǯʬޤ (: 1991)
.LP
E O ȤҤȤȤѹǤեɥǥץ⤢롣
νҤϡ̤ΥեޥåȤͤȤȤؼ롣
̤ΥեޥåȤͤߤΥ¸ߤʤȤϡ
ѹƤʤեɥǥץȤ롣
.LP
E Ҥϡ˰¸դȻ̤ɽ
ʸ˴ޤޤƤ뤳Ȥꤹ롣
.TP
.B %Ec
դȻ˰¸̤ɽȤ
.TP
.B %EC
ǯ () ̾˰¸̤ɽȤ
.TP
.B %Ex
ա˰¸̤ɽȤ
.TP
.B %EX
˰¸̤ɽȤ
.TP
.B %Ey
.B %EC
(ǯΤ) Υեåȡ˰¸̤ɽȤ
.TP
.B %EY
ʷǯ̤ɽȤ
.LP
O Ҥϡ˰¸̤ΥեޥåȤ
ͤϤ뤳Ȥꤹ롣
.TP
.BR %Od " ޤ " %Oe
νᤫ̻ա˰¸̤οͥܥȤ
0 ƬˤĤƤ褤ɬܤǤϤʤ
.TP
.B %OH
(24 )˰¸̤οͥܥȤ
.TP
.B %OI
(12 )˰¸̤οͥܥȤ
.TP
.B %Om
˰¸̤οͥܥȤ
.TP
.B %OM
ʬ˰¸̤οͥܥȤ
.TP
.B %OS
á˰¸̤οͥܥȤ
.TP
.B %OU
ǯνᤫ̻ν (λϤȤ)
˰¸̤οͥܥȤ
.TP
.B %Ow
ɽ ( 0 Ȥ)
˰¸̤οͥܥȤ
.TP
.B %OW
ǯνᤫ̻ν (λϤȤ)
˰¸̤οͥܥȤ
.TP
.B %Oy
ǯ
.RB ( %C
Υեå)˰¸̤οͥܥȤ
.LP
̤λﹽ¤ \fItm\fP
\fI<time.h>\fP ǰʲͤƤ롣
.sp
.in +4n
.nf
struct tm {
int tm_sec; /* */
int tm_min; /* ʬ */
int tm_hour; /* */
int tm_mday; /* */
int tm_mon; /* */
int tm_year; /* ǯ */
int tm_wday; /* */
int tm_yday; /* ǯ̻ */
int tm_isdst; /* ƻ */
};
.fi
.in
.SH ֤
δؿ֤ͤϡؿǽʤäǽʸؤΥݥǤ롣
եޥåʸɬפʾʸʸ˴ޤޤƤ硢
֤ͤϺǸ˽줿ʸμʸؤ
٤Ƥʸ줿硢
֤ͤʸ NULL ХȤؤ
.BR strptime ()
եޥåʸΤ٤ƤӤ˼Ԥ
顼ä硢ؿ NULL ݥ֤
.SH
SUSv2, POSIX.1-2001.
.SH
.LP
§Ȥơδؿ \fItm\fP νϤˡ
ꤵ줿ͤΤߤ롣
ĤޤꡢδؿθƤӽФ \fItm\fP ʤФʤʤ
¾ Unix ƥȤϡ٤ǰۤʤ롣
glibc μǤϡŪ˻ꤵʤեɤѹʤ
㳰ȤơǯΤ줫Ǥѹ줿
.I tm_wday
.I tm_yday
Ʒ롣
.PP
δؿϡlibc 4.6.8 ʹߤǻѤǤ롣
Linux libc4 libc5 Υ롼ɥեϡ
δؿΥץȥפ롣
glibc2 Υ롼ɥեϡ
.B _XOPEN_SOURCE
ޤ
.B _GNU_SOURCE
줿Τߡ
δؿΥץȥפ롣
.PP
libc 5.4.13 Ǥϡ ( \(aqn\(aq ޤ \(aqt\(aq ) ϰʤä
ν \(aqE\(aq \(aqO\(aq ϼդʤä
ޤ\(aqC\(aq λ \(aqc\(aq λƱ̣ǰ줿
.PP
\(aqy\(aq (1 ǯ) λϡlibc4 libc5 Ǥ 20 ǯȤƲᤵ롣
glibc 2.0 Ǥ 1950-2049 ϰϤȤƲᤵ롣
glibc 2.1 1969-2068 ϰϤȤƲᤵ롣
.\" libc4 libc5 Ǥ %I ѤΥɤƤ (glibc ǽ줿;
.\" %OI glibc 2.2.4 ǽ줿)
.SS glibc Ǥ
оΤˡglibc Ǥ
.BR strptime ()
.BR strftime (3)
ƱեޥåʸݡȤ褦ȤƤ롣
¿ξ硢бեɤᤵ뤬
\fItm\fP եɤѹʤ
Ѳǽʥեޥåʸʲ˼
.TP
.B %F
\fB%Y-%m-%d\fP ƱISO 8601 շ
.TP
.B %g
ISO бǯϴޤޤ (0-99) ϰϡ
.TP
.B %G
ISO бǯ (㤨 1991)
.TP
.B %u
10 ʿɽ (1-7 Ƿ 1 Ȥ)
.TP
.B %V
ISO 8601:1988 Ǥǯ̻ 10 ʿɽǤν (1-53)
1 1 ޤ (Ϥޤ) 4 ʾ夬ޤޤƤϡ
ν 1 Ȥ롣
3 ʲޤޤƤʤϡ1 1 ޤཱུǯκǽνȤơ
ν 1 Ȥ롣
.TP
.B %z
RFC-822/ISO 8601 ɸॿॾꤹ롣
.TP
.B %Z
ॾ̾
.LP
Ʊͤˡ
.BR strftime (3)
GNU ǤǤγĥб뤿ˡ
.B %k
.B %H
.B %P
.B %p
˰롣ޤ
.B %l
.B %I
˰褦ˤʤϤǤ롣
˰ʲƤ롣
.TP
.B %s
ǯ (㤨 1970-01-01 00:00:00 UTC) ̻ÿ
äݡȤƤʤ¤ꡢäϥȤʤ
.LP
glibc ˤǤϡ2 ĤΥեɴ֤ζɬפʤ
.SH
ʲ
.BR strptime ()
.BR strftime (3)
λˡƤ롣
.sp
.nf
#define _XOPEN_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int
main(void)
{
struct tm tm;
char buf[255];
strptime("2001\-11\-12 18:31:01", "%Y\-%m\-%d %H:%M:%S", &tm);
strftime(buf, sizeof(buf), "%d %b %Y %H:%M", &tm);
puts(buf);
exit(EXIT_SUCCESS);
}
.fi
.SH Ϣ
.BR time (2),
.BR getdate (3),
.BR scanf (3),
.BR setlocale (3),
.BR strftime (3),
.BR feature_test_macros (7)
|