Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Convert UTC Time to Local Time
WhatsApp
John
Mar 18
2016
1.2
k
0
0
<!DOCTYPE html PUBLIC
"-//W3C//Dtd XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<title>Get local time</title>
<script src=
"//code.jquery.com/jquery-1.10.2.js"
language=
"javascript"
type=
"text/javascript"
></script>
<script language=
"JavaScript"
type=
"text/JavaScript"
> function gettime() { var d =
new
Date(); document.getElementById(
"utctime"
).value= d; utc = d.getTime() + (d.getTimezoneOffset() * 60000); nd =
new
Date(utc + (3600000*+5.5)); var ist = nd.toLocaleString(); document.getElementById(
"localtime"
).value=ist; } </script>
</head>
<body onload=
"gettime()"
> UTC time :
<input type=
"text"
id=
"utctime"
/>
<br/>
<br/> Local time :
<input type=
"text"
id=
"localtime"
/>
</body>
</html>
<!DOCTYPE html PUBLIC
"-//W3C//Dtd XHTML 1.0 Transitional//EN"
"http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<title>Get local time</title>
<script src=
"//code.jquery.com/jquery-1.10.2.js"
language=
"javascript"
type=
"text/javascript"
></script>
<script language=
"JavaScript"
type=
"text/JavaScript"
> function gettime() { var d =
new
Date(); document.getElementById(
"utctime"
).value= d; utc = d.getTime() + (d.getTimezoneOffset() * 60000); nd =
new
Date(utc + (3600000*+5.5)); var ist = nd.toLocaleString(); document.getElementById(
"localtime"
).value=ist; } </script>
</head>
<body onload=
"gettime()"
> UTC time :
<input type=
"text"
id=
"utctime"
/>
<br/>
<br/> Local time :
<input type=
"text"
id=
"localtime"
/>
</body>
</html>
UTC time
Date
jquery
Up Next
Convert UTC Time to Local Time