How to get local time from UTC using Moment.JS


Moment.JS is a beautiful javascript library for parsing, validating, manipulating, and formatting dates. This is a must have utility library when it comes to manipulating timestamps and dates in javascript.

Here I will show how to get local time if you have a utc date time string.

Lets say you have a UTC date-time string as 2014-02-19 05:24:32 AM and you want to determine time in your timezone then use following code:
 moment.utc('2014-02-19 05:24:32 AM').toDate();

toDate() method gives javascript Date() object.

Below I have shared an example of how to use it. You can click on JavaScript link below to see the code.

Comments

Anonymous said…
nice
for IT the said…
Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai
ASO Services said…
There are so many useful information in your post, I like it all the time. And I want to share this boost app ranking with you, you can take a look. This is very useful.
ajay ak said…
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
Webdesining course in chennai
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
hadoop training in chennai

angularjs training in chennai
Bhuvana Kandhan said…
Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. We are providing AngularJS training in Velachery.

For more details: AngularJs training in velachery
Bhuvana Kandhan said…
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here. we are providing AngularJs training in velachery.
for more details: AngularJs training in velachery
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

website builder for reseller
Thank you for the link building list.I am going jot down this because it will help me a lot.Great blog! Please keep on posting such blog.

private label website builder
Comfortabl y, the post is really the freshest on that deserving topic. I harmonise with your conclusions and definitely will thirstily look forward to your next updates. Simply saying thanks will not simply just be adequate, for the extraordinary clarity in your writing.

white label website builder
priya said…
I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. Im fairly positive theyre likely to be informed a great deal of new stuff here than anyone
Data Science Training in Chennai
Data Science training in kalyan nagar
Data science training in Bangalore
Data Science training in marathahalli
Data Science interview questions and answers
Data science training in bangalore
Unknown said…
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.

AWS Training in Chennai
Blue Prism Training in Chennai
Unknown said…
I really like the dear information you offer in your articles. I’m able to bookmark your site and show the kids check out up here generally. Im fairly positive theyre likely to be informed a great deal of new stuff here than anyone

Angular JS Training in Chennai
Uipath Training in Chennai
for ict 99 said…
IEEE Project Domain management in software engineering is distinct from traditional project deveopment in that software projects have a unique lifecycle process that requires multiple rounds of testing, updating, and faculty feedback. A IEEE Domain project Final Year Projects for CSE system development life cycle is essentially a phased project model that defines the organizational constraints of a large-scale systems project. The methods used in a IEEE DOmain Project systems development life cycle strategy Project Centers in Chennai For CSE provide clearly defined phases of work to plan, design, test, deploy, and maintain information systems.


This is enough for me. I want to write software that anyone can use, and virtually everyone who has an internet connected device with a screen can use apps written in JavaScript. JavaScript Training in Chennai JavaScript was used for little more than mouse hover animations and little calculations to make static websites feel more interactive. Let’s assume 90% of all websites using JavaScript use it in a trivial way. That still leaves 150 million substantial JavaScript Training in Chennai JavaScript applications.

Popular posts from this blog

Measure the height of keyboard on PhoneGap app using jQuery

Step by step Cordova calabash-ios automation