Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

addfield datetime incorrect format in europe
 
t2nd
Jr. Member
 
Total Posts:  15
Joined:  2008-05-28
Roubaix, France
 

Hi,

when i create a new module, in the file “magento-local\app\code\local\Altima\News\Block\Adminhtml\News\Edit\Tab”, for example with a datetime field :

$fieldset->addField(’date’, ‘date’, array(
‘label’ => Mage::helper(’core’)->__(’Date’),
‘title’ => Mage::helper(’core’)->__(’Date’),
‘name’ => ‘date’,
‘image’ => $this->getSkinUrl(’images/grid-cal.gif’),
‘required’ => true,
));

when i choose a date value, the calendar return a date format “MM/DD/YY” while my local configuration is Europe (DD/MM/YY). I valid form and continue edit, the date is not good.

Thanks for your attention

Image Attachments
addfield-datetime.gif
 
Magento Community Magento Community
Magento Community
Magento Community
 
Brandlive_br
Guru
 
Avatar
Total Posts:  653
Joined:  2008-05-19
Buenos Aires, Argentina
 

I got the same problem. I’m looking for a solution too.
I can’t get that works fine.
If I got the right format into my form, I get a strange date into database.
When I got the right format into my database, I see the form like your screenshot.
:-(

 
Magento Community Magento Community
Magento Community
Magento Community
 
rschulze
Jr. Member
 
Total Posts:  1
Joined:  2008-07-24
Berlin, Germany
 

Change your databasefieldtype to “date” instead of “datetime” and it will work! I dont know why, but there is an issue about the “datetime"-datebasefields, i couldn’t solve, yet…

 
Magento Community Magento Community
Magento Community
Magento Community
 
t2nd
Jr. Member
 
Total Posts:  15
Joined:  2008-05-28
Roubaix, France
 

oh!!!

i find very ‘BIZARRE’ to change database structure. Thanks for your response but i search again !!!!

A response , may be :

public function dateFormat($date)
{
return $this->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
}

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top