Class TSimpleDateFormatter
TSimpleDateFormatter class.
Formats and parses dates using the SimpleDateFormat pattern. This pattern is compatible with the I18N and java's SimpleDateFormatter.
Pattern | Description ---------------------------------------------------- d | Day of month 1 to 31, no padding dd | Day of monath 01 to 31, zero leading M | Month digit 1 to 12, no padding MM | Month digit 01 to 12, zero leading yy | 2 year digit, e.g., 96, 05 yyyy | 4 year digit, e.g., 2005 ----------------------------------------------------
Usage example, to format a date
$formatter = new TSimpleDateFormatter("dd/MM/yyy"); echo $formatter->format(time());
To parse the date string into a date timestamp.
$formatter = new TSimpleDateFormatter("d-M-yyy"); echo $formatter->parse("24-6-2005");
Package: System\Util
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Since: 3.0
Located at Util/TSimpleDateFormatter.php
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>
Since: 3.0
Located at Util/TSimpleDateFormatter.php
public
|
#
__construct( string $pattern, string $charset = 'UTF-8' )
Constructor, create a new date time formatter. |
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean
|
|
public
integer
|
#
parse( string|integer $value, mixed $defaultToCurrentTime = true )
Parse the string according to the pattern. |