I've found that handling date, time, and timezone can be quite confusing. Perhaps this answer will provide some insight on how to effectively manage them.
Give this code a try in Chrome's developer console to see how the same date can be presented in various formats:
var date = new Date();
date.toISOString(); // "2017-04-29T09:54:28.714Z"
date.toGMTString(); //"Sat, 29 Apr 2017 09:54:28 GMT"
date.toLocalString(); //"4/29/2017, 3:24:28 PM"
Any date that you create on a client will always be recorded with a zero timezone offset, i.e. UTC+/-00:00 Z
. It may help to think of UTC and GMT as interchangeable. The date will be displayed according to the browser's timezone. For example, if you do console.log(date)
, it will output
Sat Apr 29 2017 15:24:28 GMT+0530 (IST)
, but the internal recording of the date remains in UTC. The display is adjusted based on the browser's timezone.
Instead of viewing date representations as conversions between timezones, consider them as different ways to represent the same date. In your browser, the date is represented with a GMT+0530
offset, but when sent to the server, it is converted back to zero timezone offset.
For instance, if you select the 4th of April at midnight in GMT+0530 timezone, internally it will be registered as the 3rd of April at 18:30 PM in GMT+0. Let it go to the server as is. When you retrieve this date for use, it will return as the 3rd of April and displayed according to the browser's timezone. There is no conversion happening, just different representations of the same date.
If you're interested, I once posed a related question, which might provide further clarification.
Overall, this answer reiterates the points made by @geminiousgoel and @charlietfl.