Class CDateTimeParser
CDateTimeParser converts a date/time string to a UNIX timestamp according to the specified pattern.
The following pattern characters are recognized:
Pattern | Description ---------------------------------------------------- d | Day of month 1 to 31, no padding dd | Day of month 01 to 31, zero leading M | Month digit 1 to 12, no padding MM | Month digit 01 to 12, zero leading MMM | Abbreviation representation of month (available since 1.1.11; locale aware since 1.1.13) MMMM | Full name representation (available since 1.1.13; locale aware) y | 4 year digit, e.g., 2005 (available since 1.1.16) yy | 2 year digit, e.g., 96, 05 yyyy | 4 year digit, e.g., 2005 h | Hour in 0 to 23, no padding hh | Hour in 00 to 23, zero leading H | Hour in 0 to 23, no padding HH | Hour in 00 to 23, zero leading m | Minutes in 0 to 59, no padding mm | Minutes in 00 to 59, zero leading s | Seconds in 0 to 59, no padding ss | Seconds in 00 to 59, zero leading a | AM or PM, case-insensitive (since version 1.1.5) ? | matches any character (wildcard) (since version 1.1.11) ----------------------------------------------------
All other characters must appear in the date string at the corresponding positions.
For example, to parse a date string '21/10/2008', use the following:
$timestamp=CDateTimeParser::parse('21/10/2008','dd/MM/yyyy');
Locale specific patterns such as MMM and MMMM uses CLocale
for
retrieving needed information.
To format a timestamp to a date string, please use CDateFormatter
.
Package: system\utils
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/utils/CDateTimeParser.php
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/utils/CDateTimeParser.php
public static
integer
|
|
public static
|
|
protected static
string
|
|
protected static
string
|
|
protected static
string
|