Can any one give exact idea for DD/MM/YYYY information to be saved in my table,instead format as YYYY/MM/DD
Thank you in advance…
Regards
SAM
Can any one give exact idea for DD/MM/YYYY information to be saved in my table,instead format as YYYY/MM/DD
Thank you in advance…
Regards
SAM
Databases store dates in their representation if you use DATE fields… if you want to store it another way you can use string fields (VARCHAR)… but that is not a good practice… there is no problem to read the date from the database and convert it for display… the same for saving…
The only way I found so far is converting date manually in actionCreate and in views…
Not so smart, imho.
Is there a way to set the date format globally, without converting it manually in views and controllers?
Why doesn’t you use timestamp ? You can retrieve it in your own way.
However you are saving the data, you will need to translate from the format in the localized format.
You can do it easily in the beforeSave and afterFind functions