| format_date helper - ShortDatePattern Problem [message #20249] |
Tue, 23 January 2007 15:54  |
virtualize Messages: 36 Registered: July 2006 Location: Zürich, Switzerland |
Member |
|
|
hi,
i'm trying to format a date with the format_date helper.
according to the docs ( http://www.symfony-project.com/book/trunk/templating_i18n_he lpers) the ShortDatePattern ('d') should give MM/dd/yyyy.
format_date($employee->getBirthDate(), 'd')
but i only get dates with a 2-digit year, like 23/01/07. how do i get the 4-digit year, like this 23/01/2007 ?
thanks in advance
christopher
|
|
|
|
|
|
|
|
| <SOLVED!!> Re: format_date helper - ShortDatePattern Problem [message #67481 is a reply to message #20339 ] |
Thu, 11 December 2008 20:07   |
carolina.boerr Messages: 4 Registered: November 2008 |
Junior Member |
|
|
Seeking and looking I found the solution in
http://groups.google.com/group/symfony-es/browse_thread/thre ad/d95dbf5cb841f6db/93f8c1f73026665f?lnk=gst&q=formato+f echa+list#93f8c1f73026665f
Thanks a lot anyway!
----
Hi mikenolan:
I see that you've faced some problems with dates and maybe you can help me.
I'm using admin generator and i18n.
My default culture es en_US but I'm working with a user culture=es_AR
In the edit view, dates are shown correctly, with format dd/mm/yyyy but in my list view, they are shown in a strange format.
For example: edit-> 31/12/2008
is shown in list view as-> 2008/12/2031
My generator.yml is
list:
title: Listado
display: [fecha_desde, fecha_hasta]
actions:
_create:
object_actions:
_edit:
_delete:
fields:
fecha_desde: {params: date_format="p"}
fecha_hasta: {params: date_format="p"}
edit:
title: Creación/Modificación
display: [fecha_desde, fecha_hasta]
fields:
fecha_desde: {params: date_format="p"}
fecha_hasta: {params: date_format="p"}
To set the user culture, I've changed actions.class.php of my module:
class LicenciasActions extends autoLicenciasActions
{
public function executeList()
{
$this->getUser()->setCulture('es_AR');
parent::executeList();
}
}
Have you had this problem at all?
Do you have any suggestion?
Thanks a lot in advance!
Carolina
[Updated on: Thu, 11 December 2008 20:35]
|
|
|
| Re: <SOLVED!!> Re: format_date helper - ShortDatePattern Problem [message #72324 is a reply to message #67481 ] |
Fri, 13 February 2009 08:02  |
manuelR Messages: 1 Registered: February 2009 Location: Medellín, Colombia |
Junior Member |
|
|
I have the exact same problem Carolina. Is there anything on to this yet?
I saw in other post that using yy-MM-dd solves the problem but it doesnt. it just shortens some dates, but generally i keep getting the same weird year/date day: i.e February 2nd 2009 = 2002-02-2009
I've tried every single pattern anything on this?
|
|
|