|
NAMEstrtotime , timetostr —
date and time conversions.
SYNOPSIS#include <strfunc.h>
time_t
char *
DESCRIPTIONThose functions used to convert time format from string to binary time_t and vice versa.
20000930T172458+0400 or 2000-09-30T17:24:58+0400 or 2000-09-30T21:24:58Z
Sat, 30 Sep 2000 17:24:58 +0400 (MSD) or Sat, 30 Sep 2000 17:24:58 +0400 or even Sat, 30 Sep 2000 17:24:58 MSD that is but widely used, but lame, though correctly handled by strtotime.
Sat Sep 30 17:24:58 2000
Mar 23 19:07:43
Thursday, 10-Jun-93 01:29:59 GMT Thu, 10 Jan 1993 01:29:59 GMT Wed Jun 9 01:29:59 1993 GMT 1997/06/23 13:22:33 and derivatives. Support for other time representation formats can be added upon request.
Those flags are present to specify the output format. And the following ones exist to slightly modify the output:
Those flags can be mixed by OR'ing. RETURN VALUESThestrtotime () function returns the value of given time
representation in seconds since 0 hours, 0 minutes, 0 seconds, January 1,
1970, Coordinated Universal Time. If parse error occured, zero is returned and
global variable errno is set to EINVAL to indicate an
error.
EXAMPLEvoid test() { char *timeString = "Sat, 1 Oct 2000 01:34:00 +0400"; time_t timeValue = 970348600; printf("timeString -> time_t: %ld\n", (long)strtotime(timeString)); printf("timeValue -> string: %s\n", timetostr(timeValue, TFMT_RFC822 | TFMT_LOCAL | TFMT_UF)); } SEE ALSOstrfunc(3), ctime(3), asctime(3).AUTHORSLev Walkin <vlm@lionet.info>
Visit the GSP FreeBSD Man Page Interface. |