i have to inputs that i want to format in an easy to read format, however when the user selects the date, i need the output to be in a format that mysql can handle. i dont think i can change the view format independantly from the output format. so im trying to achieve what i want by using hidden input elements and alt field in timepicker but i seem to be missing something. is there a better way of doing this or am i on the right track, i can't seem to get it to work.
$('.startDate').datetimepicker({
timeFormat : "hh:mm tt",
separator: ' ',
showTimezone: false,
altField: ".startDateHidden",
altFieldTimeOnly: false,
altFormat: "yy-mm-dd",
altTimeFormat: "h:m t",
altSeparator: " "
});
$('.endDate').datetimepicker({
timeFormat : "hh:mm tt",
separator: ' ',
showTimezone: false,
altField: ".endDateHidden",
altFieldTimeOnly: false,
altFormat: "yy-mm-dd",
altTimeFormat: "h:m t",
altSeparator: " "
});
$('.startDate, .endDate, .startDateHidden, .endDateHidden').datetimepicker('setDate', (new Date()) );
EDIT: well later in my code i make a call to the hidden fields to use the dates in an ajax call, but the getDate is returning empty for the hidden elements, being var date3 and date4
var date1 = $('.startDate').datetimepicker('getDate');
var date2 = $('.startDate').datetimepicker('getDate');
var date3 = $('.startDateHidden').datetimepicker('getDate');
var date4 = $('.endDateHidden').datetimepicker('getDate');
console.log(date1);
console.log(date2);
console.log(date3);
console.log(date4);