Zend Date Class Constants Cheat Sheet

Loading

Date and time handling in general is a problem in programming. For PHP programmers, there's a good library out there that performs all the difficult tasks and provides convenient APIs. Zend_Date has several constants defined. It is good to know what each one of them represents. For this purpose, I have made a cheat sheet. Download the PDF and enjoy.

The table has the constant name and sample value columns.

Constant Value
Zend_Date::DAY 25
Zend_Date::DAY_SHORT 25
Zend_Date::DAY_SUFFIX th
Zend_Date::DAY_OF_YEAR 358
Zend_Date::WEEKDAY Saturday
Zend_Date::WEEKDAY_SHORT Sat
Zend_Date::WEEKDAY_NARROW S
Zend_Date::WEEKDAY_NAME Sat
Zend_Date::WEEKDAY_8601 6
Zend_Date::WEEKDAY_DIGIT 6
Zend_Date::WEEK 51
Zend_Date::MONTH 12
Zend_Date::MONTH_SHORT 12
Zend_Date::MONTH_DAYS 31
Zend_Date::MONTH_NAME December
Zend_Date::MONTH_NAME_SHORT Dec
Zend_Date::MONTH_NAME_NARROW D
Zend_Date::YEAR 2010
Zend_Date::YEAR_SHORT 10
Zend_Date::YEAR_8601 2010
Zend_Date::YEAR_SHORT_8601 10
Zend_Date::LEAPYEAR 0
Zend_Date::MERIDIEM PM
Zend_Date::SWATCH 805
Zend_Date::HOUR 18
Zend_Date::HOUR_SHORT 18
Zend_Date::HOUR_AM 06
Zend_Date::HOUR_SHORT_AM 6
Zend_Date::MINUTE 19
Zend_Date::MINUTE_SHORT 19
Zend_Date::SECOND 53
Zend_Date::SECOND_SHORT 53
Zend_Date::MILLISECOND 0
Zend_Date::TIMEZONE_NAME UTC
Zend_Date::DAYLIGHT 0
Zend_Date::GMT_DIFF +0000
Zend_Date::GMT_DIFF_SEP +00:00
Zend_Date::TIMEZONE UTC
Zend_Date::TIMEZONE_SECS 0
Zend_Date::ISO_8601 2010-12-25T18:19:53+00:00
Zend_Date::RFC_2822 Sat, 25 Dec 2010 18:19:53 +0000
Zend_Date::TIMESTAMP 1293301193
Zend_Date::ERA AD
Zend_Date::ERA_NAME Anno Domini
Zend_Date::ERA_NARROW A.
Zend_Date::DATES Dec 25, 2010
Zend_Date::DATE_FULL Saturday, December 25, 2010
Zend_Date::DATE_LONG December 25, 2010
Zend_Date::DATE_MEDIUM Dec 25, 2010
Zend_Date::DATE_SHORT 12/25/10
Zend_Date::TIMES 6:19:53 PM
Zend_Date::TIME_FULL 6:19:53 PM UTC
Zend_Date::TIME_LONG 6:19:53 PM UTC
Zend_Date::TIME_MEDIUM 6:19:53 PM
Zend_Date::TIME_SHORT 6:19 PM
Zend_Date::DATETIME Dec 25, 2010 6:19:53 PM
Zend_Date::DATETIME_FULL Saturday, December 25, 2010 6:19:53 PM UTC
Zend_Date::DATETIME_LONG December 25, 2010 6:19:53 PM UTC
Zend_Date::DATETIME_MEDIUM Dec 25, 2010 6:19:53 PM
Zend_Date::DATETIME_SHORT 12/25/10 6:19 PM
Zend_Date::ATOM 2010-12-25T18:19:53+00:00
Zend_Date::COOKIE Saturday, 25-Dec-10 18:19:53 UTC
Zend_Date::RFC_822 Sat, 25 Dec 10 18:19:53 +0000
Zend_Date::RFC_850 Saturday, 25-Dec-10 18:19:53 UTC
Zend_Date::RFC_1036 Sat, 25 Dec 10 18:19:53 +0000
Zend_Date::RFC_1123 Sat, 25 Dec 2010 18:19:53 +0000
Zend_Date::RFC_3339 2010-12-25T18:19:53+00:00
Zend_Date::RSS Sat, 25 Dec 2010 18:19:53 +0000
Zend_Date::W3C 2010-12-25T18:19:53+00:00

You can generate a table like this yourself using reflection feature of PHP.

<?php
class = new ReflectionClass('Zend_Date');
$dateConstants $class->getConstants();
$date = new Zend_Date();
  
echo 
"<table>";
foreach (
$dateConstants as $dateConstantKey=>$dateConstantValue){
    echo 
"<tr>";
    echo 
"<td>Zend_Date::";
    echo 
$dateConstantKey;
    echo 
"</td>";
    echo 
"<td>";
    echo 
$date->get($dateConstantValue);
    echo 
"</td>";
    echo 
"</tr>";
}
echo 
"</table>";

?>

About the author

Sudheer is an entrepreneur and software developer. Get more from Sudheer on Twitter.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.
By submitting this form, you accept the Mollom privacy policy.