According to this documentation, http://jqueryui.com/demos/datepicker/#option-altFormat
I can set a different date format for the user to see, and a different format to actually send to the server.
However, both seem to show the same format.
Here is my code:
$("#joindate").datepicker({
dateFormat: $.datepicker.TIMESTAMP,
altFormat: 'yy-mm-dd'
});
And, I would want the user to see yy-mm-dd format, and send the timestamp to the server using my post request. I have switched the values of altFormat and dateFormat, but either I get yy-mm-dd in both (textbox and $_POST) or the timestamp in both.
Is there a workaround to this ?
A date-picker of jQuery UI is used to provide a calendar to the user to select the date from a Calendar. This date picker usually connected to a text-box so user selection of date from the calendar can be transferred to the textbox.
An input element that is to be updated with the selected date from the datepicker. Use the altFormat option to change the format of the date within this field.
The jQuery DatePicker plugin supports multiple Date formats and in order to set the dd/MM/yyyy Date format, the dateFormat property needs to be set. The following HTML Markup consists of a TextBox which has been made Read Only.
By default, the date format of the jQuery UI Datepicker is the US format mm/dd/yy, but we can set it to a custom display format, eg: for European dates dd-mm-yyyy and so on. The solution is to use the date picker dateFormat option.
I think you must read this
The dateFormat to be used for the altField option. This allows one date format to be shown to the user for selection purposes, while a different format is actually sent behind the scenes. For a full list of the possible formats see the formatDate function
Reference:
http://api.jqueryui.com/datepicker/#option-altField
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