I am trying to standardise the time the database gets from a the bootstrap time date form, however I am getting the following error
Uncaught TypeError: e.date.getTime is not a function
When I print out e.date
it is Wed Jul 15 2015 16:30:51 GMT+1200
I am attempting to follow this guide, but I have had to change a few things to get this far.http://jsfiddle.net/TC6Gr/37/
$('#start_time').datetimepicker({
format: 'DD-MM-YYYY h:mm:ss a',
}).on("dp.change", function (e) {
alert(e.date);
$('#start-time-before').html(e.date); // Log
var TimeZoned = new Date(e.date.setTime(e.date.getTime() + (e.date.getTimezoneOffset() * 60000)));
$('#end_time').datetimepicker('setStartDate', TimeZoned);
$('#start_time').datetimepicker('setDate', TimeZoned);
$('#start-time-adjusted').html(TimeZoned); // Log
});
Use this line
new Date("2018/10/10 09:27");
This can create a Date object. You will return Date object's getTime() or valueOf() functions with the UTC timestamp.
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