I have MySQL table with date field (yy-mm-dd).
And I have form with datepicker that edits it and it works fine.
BUT at the frontend date is displayed as mm-dd-yy and that can be confusing.
I'd like field with datepicker to display value as mm-dd-yy, but the actual value should be of the old format (yy-mm-dd).
How to reach this?
Added: I know how to change format of date. I want separate displayed value and actual value. That's what it is all about.
The jQuery UI Datepicker widget comes with altField
and altFormat
options that allow you to set a secondary (hidden if you want) form input to store the date in whatever format you want:
$( ".selector" ).datepicker({
altField : '#actualDate',
altFormat : 'yy-mm-dd'
});
Source: http://jqueryui.com/demos/datepicker/#option-altFormat
Here is a demo: http://jsfiddle.net/MmKmq/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With