Showing results for 
Search instead for 
Did you mean: 

custom model saving wrong date

custom model saving wrong date

Hi there,


kind newbie here. On my 1.9.2 I developed my own model, everything works perfectly except when, from adminhtml edit, I save it this way:


 $model = Mage::getSingleton('admindb/contrattolicenza');
try {

the data is actually saved, but te 2 dates I have in my model are both 1970-01-01. I suppose (but I'm not sure) this is because my admin is in italian, and the date format is d/m/Y.

Any suggestion?


Thanks a lot


Re: custom model saving wrong date

yes, you have to convert data to GMT when saving and convert back to local when loading/displaying with Mage_Core_Model_Locale.

or if you don't care about timezone and format, you can simply set the date field varchar

Re: custom model saving wrong date



thanks a lot for your answer. Coul you please be so kind to write an example on how to convert? I guess magento has it's own way to do that...


Thanks again