beenote / angular-material-datetimepicker

Date time picker for Angular Material JS
https://beenote.github.io/angular-material-datetimepicker
MIT License
44 stars 31 forks source link

Mysql format issue #24

Closed ghost closed 6 years ago

ghost commented 6 years ago

There is now way post for mysql format.

Current post format: Mon Dec 11 2017 23:40:51 GMT+0300 (+03)

It should be for mysql; 2017-11-03 23:40:51

hexadecy commented 6 years ago

The format is a date you have to transform before the post. Normally http libraries transform the js date to a Json.

The conversion to mysql should be done by the backend service.

ghost commented 6 years ago

I found the solution;

date: moment($scope.reminder_date).format("YYYY-MM-DD HH:mm:ss"),

hexadecy commented 6 years ago

Ok you are converting the date to a string format, but you are losing the client timezone.

$scope.reminder_date.toJSON()
2017-11-03T18:25:43.511Z

Just make sure your server is set to GMT+0300. Some Linux distribution are set to UTC.