Zend Framework

print new Zend_Date(); does not print timestamp but a formatted date

Details

  • Type: Docs:  Improvement Docs: Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Not an Issue
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: Zend_Date
  • Labels:
    None

Description

Hello, documentation at http://framework.zend.com/manual/en/zend.date.basic.html says this

$date = new Zend_Date();

// Output of the current timestamp
print $date;

I tried it and it printed a formatted date, not a unix timestamp as I had expected. Btw. idk why this box keeps shrinking as I am typing...

Activity

Hide
Adam Lundrigan added a comment -

I think the wording of that section is just misleading. To me it's saying it gets the UNIX timestamp from time() if no constructor arguments are passed, not that it returns one when you print it. The word "timestamp" refers to the act (ie: stamping an item with the current date/time) and not to the formatting. If i'm reading the code correctly, the default behaviour of Zend_Date is to print a date/time string formatted based upon the locale set (See {Zend/Date.php L461|http://framework.zend.com/code/blame.php?repname=Zend+Framework&path=%2Ftrunk%2Flibrary%2FZend%2FDate.php#l461]).

Show
Adam Lundrigan added a comment - I think the wording of that section is just misleading. To me it's saying it gets the UNIX timestamp from time() if no constructor arguments are passed, not that it returns one when you print it. The word "timestamp" refers to the act (ie: stamping an item with the current date/time) and not to the formatting. If i'm reading the code correctly, the default behaviour of Zend_Date is to print a date/time string formatted based upon the locale set (See {Zend/Date.php L461|http://framework.zend.com/code/blame.php?repname=Zend+Framework&path=%2Ftrunk%2Flibrary%2FZend%2FDate.php#l461]).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: