Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

utc to local time javascript

var UTCDate = '6/29/2011 4:52:48 PM';
var localDate = new Date(UTCDate + ' UTC');
Comment

js UTC to local timezone

// 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
Comment

javascript convert utc to local time

var date = new Date('6/29/2011 4:52:48 PM UTC');
date.toString() // "Wed Jun 29 2011 09:52:48 GMT-0700 (PDT)"
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript string includes 
Javascript :: un hover in jquery 
Javascript :: Use History React Router v6 app 
Javascript :: set drain docker node 
Javascript :: event.target parent 
Javascript :: js fizzbuzz 
Javascript :: text to 64base javascript 
Javascript :: react native flatlist 
Javascript :: toggle hidden attribute javascript 
Javascript :: how convert object to string and string to object in javascript 
Javascript :: javascript base64 encode file input 
Javascript :: try catch in node js 
Javascript :: phaser 3 add button 
Javascript :: update nodejs ubuntu 
Javascript :: flatten in js without lodash 
Javascript :: mongodb add admin user 
Javascript :: laravel 419 
Javascript :: roblox headshot image 
Javascript :: lottie react 
Javascript :: usenavigate react router dom v6 
Javascript :: how to divide array in chunks 
Javascript :: jspdf add page 
Javascript :: javascript redirect to route laravel 
Javascript :: javascript check if json file is empty 
Javascript :: buffer from base64 
Javascript :: jquery remove items from dropdownlist 
Javascript :: jquery replace h1 with h2 
Javascript :: mongoose custom object schema 
Javascript :: get value by name array from select in jquery 
Javascript :: how to make nextjs image component responsive 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =