SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 463 | Next

James Kennard

"Mastering Joomla! 1.5 Extension and Framework Development"

This table details some of the more common format designators:
Format Designator Description
a Weekday name (abbreviated)
A Weekday name
b Month name (abbreviated)
B Month name
d Day of the month (zero padded)
e Day of the month
H Hour (24 hour and zero padded)
I Hour (12 hour and zero padded)
m Month (zero padded)
M Minute (zero padded)
p 12 hour 'am' or 'pm'.
S Second (zero padded)
y Year (two digits)
Y Year (four digits)
Chapter 12
[ 343 ]
This example outputs a date in a custom format:
// custom date format
$custom = $date->toFormat('%A, %Y/%m/%d');
We don't have to supply a custom format string to the toFormat() method. If we
choose not to, the default format is %Y-%m-%d %H:%M:%S.
In most cases, we should not directly use a string to specify the format. Instead, we
should use a translated string. This guarantees that we use a format that is valid for
the current locale.
The table below describes the date and time format names and their English
(British) value:
Format Name en-GB value Example
DATE_FORMAT_LC %A, %d %B %Y Thursday, 01 January 1970
DATE_FORMAT_LC1 %A, %d %B %Y Thursday, 01 January 1970
DATE_FORMAT_LC2 %A, %d %B %Y %H:%M Thursday, 01 January 1970 00:00
DATE_FORMAT_LC3 %d %B %Y 01 January 1970
DATE_FORMAT_LC4 %d.


Pages:
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475