| |
strptime
Format:
strptime( string, format, time ) |
Purpose:
Parse a string-formatted time value.
The string and format parameter must denote a string.
The time parameter must be a value to which an object
containing the broken down time can be assigned.
The structure of a broken down time object is described in localtime().
Return Values:
Returns null if string cannot be parsed using format.
Otherwise, it returns the position after the last character within string that has been parsed.
The format string consists of
zero or more conversion specifications and ordinary characters. A
conversion specification consists of a '%' (percent) character followed
by a character that determines the specification's behavior. Ordinary
characters are copied unchanged into the result string. Each
conversion specification is replaced by appropriate characters as
described in the following list.
conversion | replacement |
%% | percent character |
%a | abbreviated weekday name |
%A | full weekday name |
%b | abbreviated month name |
%B | full month name |
%c | default date and time representation (same as %x %X) |
%d | day of month, two digits 01-31 |
%H | hour, two digits 00-23 |
%I | hour, two digits 01-12 |
%j | day of the year, three digits 001-366 |
%m | month number, two digits 01,12 |
%M | minute, two digits 00-59 |
%p | a.m. or p.m. designation of the 12-hour clock |
%r | time as %I:%M:%S %p |
%R | time as %H:%M |
%S | second, two digits 00-61. |
%T | time as %H:%M:%S |
%w | weekday number, 0-6, Sunday is 0 |
%x | default date representation |
%X | default time representation |
%y | year within century, two digits 00-99 |
%Y | year with century |
Note:
In principle, this function does not initialize the
time parameter but only stores the values specified.
But since we don't know beforehand whether daylight saving time (DST) is
in effect or not, the time object's isdst field
is set to -1 for heitml versions > 2.05.
|
Example:
input: | resulting output:
|
<? strptime ("Tuesday Feb 29 2000", "%A %b %d %Y", tm) "NN";
? tm> | 19(sec=0, min=0, hour=0, mday=29, mon=1, year=2000, wday=2, yday=59, isdst=-1) |
<? strptime ("02/29/2000", "%m/%d/%Y", tm) "NN"; ? tm> | 10(sec=0, min=0, hour=0, mday=29, mon=1, year=2000, wday=2, yday=59, isdst=-1) |
<? strptime ("13/33/2002", "%m/%d/%Y", tm) "NN"; ? tm> | NULL(sec=0, min=0, hour=0, mday=0, mon=0, year=1900, wday=0, yday=0, isdst=-1) |
Note:
Internationalization support is planned for the next major revision of heitml.
|
See Also:
caltime(), difftime(), gmtime(), localtime() mktime(), strftime().
This page was dynamically generated by the
web application development tool RADpage
of H.E.I.
Selected blog articles :
3D Objects on HTML pages,
CSS Transition Visibility, and
CSS Transition Display.
© 1996-2024 H.E.I. All Rights Reserved.
|