Question : utc to local time javascript
Answered by : munchduster
var UTCDate = '6/29/2011 4:52:48 PM';
var localDate = new Date(UTCDate + ' UTC');
Source : | Last Update : Mon, 13 Sep 21
Question : convert local time to utc javascript
Answered by : you
// Get current local date and time
const localDate = new Date();
// Convert local date and time to UTC
const utcDate = new Date(localDate.getTime() + localDate.getTimezoneOffset() * 60000);
// Format the UTC date and time as a string
const utcDateString = utcDate.toISOString();
console.log(utcDateString);
Source : | Last Update : Tue, 19 Sep 23
Question : js UTC to local timezone
Answered by : lonely-llama-d9yyxgwlxp65
// This would come from the server.
// Also, this whole block could probably be made into an mktime function.
// All very bare here for quick grasping.
d = new Date();
d.setUTCFullYear(2004);
d.setUTCMonth(1);
d.setUTCDate(29);
d.setUTCHours(2);
d.setUTCMinutes(45);
d.setUTCSeconds(26);
console.log(d); // -> Sat Feb 28 2004 23:45:26 GMT-0300 (BRT)
console.log(d.toLocaleString()); // -> Sat Feb 28 23:45:26 2004
console.log(d.toLocaleDateString()); // -> 02/28/2004
console.log(d.toLocaleTimeString()); // -> 23:45:26 Run code snippet
Source : https://stackoverflow.com/questions/85116/display-date-time-in-users-locale-format-and-time-offset | Last Update : Sun, 07 Nov 21
Question : javascript convert utc to local time
Answered by : vastemonde
var date = new Date('6/29/2011 4:52:48 PM UTC');
date.toString() // "Wed Jun 29 2011 09:52:48 GMT-0700 (PDT)"
Source : https://stackoverflow.com/questions/6525538/convert-utc-date-time-to-local-date-time | Last Update : Tue, 25 May 21
Question : grepper subscription required
Answered by : code-grepper
{"tags":[{"tag":"p","content":"You have reached your max daily Grepper answers. <a href=\"https://www.grepper.com/subscriptions.php\" target=\"_blank\" rel=\"nofollow\">Upgrade to professional </a>to view more Grepper answer today."},{"tag":"p","content":"<a href=\"https://www.grepper.com/api/view_product.php?hl=1&pid=42\" target=\"_blank\" rel=\"nofollow\">Upgrade To Grepper Professional</a>"}]}
Source : | Last Update : Mon, 27 Mar 23