|
|||
|
Please hit me if I'm wrong, but I couldn't find a method that returns a string representation of the date format currently used to format the date. I need a method that returns something like "dd.mm.yyyy" if the current format is Zend_Date::DATE_MEDIUM. Such a string representation f.i. is used by the JQuery table sorter which then can sort table columns of the given date format. But maybe I'm just blind ;) Hope you can help.
|
|
|||
|
Hello,
You can find a list of date constants at: framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.list Something like this would work for you: $myDate = new Zend_Date(strtotime('2007-07-13')); $myDate->toString("dd.MM.YYYY"); Cheers |
|
|||
|
Sorry, but it seems you got me wrong. The problem is, that I'm running a multi-language site. That's why I'm only using the localized constants like DATE_LONG, DATE_MEDIUM, etc.
I'm looking for a way to get the underlying format for the current locale behind DATE_MEDIUM. The "dd.mm.yyyy" I wrote was just an example what DATE_MEDIUM may currently look like in a german locale f.i. And I didn't find a method that simply returns this string representation of the format that's currently used as DATE_MEDIUM, DATE_LONG, etc. |
|
|||
|
Zend_Date takes locale as a parameter. So you can also try:
$myDate = new Zend_Date(strtotime('2007-07-13'), false, 'de'); and this should convert dates to their localized formats. Sorry but I am not too sure about using the localized constants like DATE_LONG to automatically make dates in their locale format. Perhaps use the above and play around with toString() to see what you can get. I am also now working on a multi-lingual site and am playing around with dates, so if I come across anything I will post it. Cheers |
|
|||
|
There's a method located inside the Zend_Locale class that helps a bit. But it's not quite 100% percent what I was looking for.
Code:
Zend_Locale_Format::getDateFormat($locale]); Code:
Zend_Date::DATE_MEDIUM ![]() |
|
|||
|
Hi, I have a field database field called created_at which is assigned when an new instance is created and I use the following:
PHP Code:
0000-00-00 00:00:00 Also, when I view the contents of the DB, I'm seeing the same results. Thus, if anyone has the answer for this, please post the solution. Thanks in advance, -Conrad ![]() |
|
|||
|
Quote:
PHP Code:
PHP Code:
Thanks again, -Conrad |
|
|||
|
I have used Data class and found some mismatch of date usage. How to solve this?
in pHP: date("Y-m-d"): gives 2008-02-23 in zf : $date->toString("Y-m-d"); give 2008-i-23 like that. Time also coming like that . how to solve this and how to take the time 05:25:04 and date 2008-02-25? - mugesh |
|
|||
|
Quote:
use $date->get('YYYY-MM-dd HH:mm:ss') to show both date and time, or $date->get('YYYY-MM-dd') to show date only.
__________________
------------------ Loris Candylaftis |
![]() |
| Thread Tools | |
| Display Modes | |
|
|