TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Convert UTC Time to Local Time
John
Mar 18
2016
Code
1.1
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
<!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