I insert the date into the database in two different formats.
this is insert as datetime
var mydate;
mydate = new Date();
document.getElementById('clockinhour').value = mydate.toISOString().slice(0, 19).replace('T', ' ');
Output A
2017-06-21 20:14:31
this is an insert like varchar:
document.getElementById('clocked_in_time').value = Date();
Exit B
Wed Jun 21 2017 16:14:31 GMT-0400 (Eastern Standard Time)
Output B is the correct time, but I need to display output A. What makes time change when converting to an ISOString? How can i fix this?
source
share