I need to change the local or current TimeZone to Default UTC (GMT+0000
) time zone.
I used the predefined javascript function toLocaleString
, but some machines has their own datetime format so the service request gets mismatched.
My requirement is just change the TimeZone without changing the current value (NO CONVERSTION)
let dtime = new Date();
console.log(dtime);
Output: Fri Jul 07 2017 17:07:32 GMT+0530 (India Standard Time)
Required Format is Fri Jul 07 2017 17:07:32 GMT+0000 (???)
Scenario: I'm selecting DOB in DatePicker
(Angular Material
), Its returning the datetime offset
value. If I pass those value from client to Server, it automatically converts it to Local to UTC Default.
For Example: I'm selecting DOB as 1990-01-01
in datepicker
, it returns the value 1990-01-01 00:00:00
but in HTTP call it goes as 1989-12-31 18:30:00
. Because I'm in INDIA (UTC +0530
), so it subtracts the 05 Hours and 30 Minutes. This is the issue I'm facing.
Kindly assist me.