Class \Prado\Util\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/yyyy");
echo $formatter->format(time());
To parse the date string into a date timestamp.
$formatter = new TSimpleDateFormatter("d-M-yyyy");
echo $formatter->parse("24-6-2005");
Class hierarchy
Author: Wei Zhuo <weizhuo[at]gmail[dot]com>Since: 3.0
public
|
__construct(string $pattern[, string $charset = 'UTF-8' ]) : mixed
Constructor, create a new date time formatter.
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
parse(int|string $value[, bool $defaultToCurrentTime = true ]) : int
Parse the string according to the pattern.
|
public
|
|
public
|
|
private
|
|
private
|
charEqual(mixed $string, mixed $pos, mixed $char) : mixed
Returns true if char at position equals a particular char.
|
private
|
|
private
|
getInteger(string $str, int $i, int $minlength, int $maxlength) : string
Gets integer from part of a string, allows integers of any length.
|
private
|
|
private
|
substring(mixed $string, mixed $start, mixed $length) : mixed
Gets a portion of a string, uses iconv_substr.
|
|