A unix timestamp should only be ten characters, however I keep getting 13 characters and it’s causing me issues. How can I fix this?
<script type="text/javascript">
$(document).ready(function()
{
$("#startdate").datepicker({ altField: "#startdatehidden", altFormat:$.datepicker.TIMESTAMP, dateFormat:$.datepicker.TIMESTAMP, mandatory: true });
});
</script>
though I would recommend you validate date on server and make changes there if possible, for instance a user might not have javascript and would manually put a date there that you should anyway try to turn into date (in php with strtotime) and you could use the same block to convert js timestamp to unix timestamp! There is alot you have to do to make this bullet proof on the client-side as I will explain one scenario but to answer your question and go about it your way this is a way to start:
You will need create a separate input field to display the jQuery UI Datepicker lets call it
and then your old
<input type='hidden' name='startdate' id='startdate'>which will be used for your server-side code, but you will not apply the jQuery datepicker on this field. You can put it as type text for testing then change it to hidden since user doesn’t need to see this!