Date picker date format not changing
Permalink 2 users found helpful
My date picker works in the format of mm/dd/yy.
But in the mysql is not matched format. So, It is not storing the date.
I changed date format in jquery.ui.js. But Its just showing the in the same pattern.'
I need to change this format in to yy/mm/dd.
Please show me some way to retrieve from this problem...'Thanks in advance...
But in the mysql is not matched format. So, It is not storing the date.
I changed date format in jquery.ui.js. But Its just showing the in the same pattern.'
I need to change this format in to yy/mm/dd.
Please show me some way to retrieve from this problem...'Thanks in advance...
Where I have to set locale for date-picker?
Could you mention the what php file contains this set locale...
Could you mention the what php file contains this set locale...
Can you post the jquery code?
Its not jQuery. Its php in the save method of the controller.
Thanks Johnthefish,
When I select date from datepicker, it shows in the text box in mm/dd/yy format.
So, during the inser data into database, date saved as 0000-00-00.
When I select date from datepicker, it shows in the text box in mm/dd/yy format.
So, during the inser data into database, date saved as 0000-00-00.
You have to set both format same for frontend and database. If the date format shows in textbox like mm/dd/yy, you can simply convert it to timestamp and then regenerate it to yyyy-mm-dd format for save into database. As @john said, the process can be done in the controller file from where you have written the save method.
Rony
Rony
Thanks @Shankumars and @Rony
It's Works... ;-)
Exactly this is what i need...
It's Works... ;-)
Exactly this is what i need...
I think the problem might be related to this bug:
http://www.concrete5.org/index.php?cID=547045...
http://www.concrete5.org/index.php?cID=547045...
So when saving from a form field that you set with the date picker, you need to translate the format from whatever the c5 front end format for the datepicker is (set by locale) into the mySQL format.
Then when retrieving, do the reverse.
There is a date helper for this which takes locale into account. There are also standard php functions that do such a translation.