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 ict 99 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.
Naveen S said…
Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
Webdesining course in chennai
Mallela said…
Thanks for posting the best information and the blog is very helpful.Data science course in Faridabad
CloudLearn ERP said…
I would like to thank you for getting my neurons conspicuous with this brilliant article that you have written which contains every potential points which needs to considered on the given topic. Thanks for chipping in such a brilliant writing!
Data Science training in Mumbai
Data Science course in Mumbai
SAP training in Mumbai

Maneesha said…
I’m not that much of a internet reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back down the road. Many thanks
data scientist training and placement in hyderabad

Really wonderful blog completely enjoyed reading and learning to gain the vast knowledge. Eventually, this blog helps in developing certain skills which in turn helpful in implementing those skills. Thanking the blogger for delivering such a beautiful content and keep posting the contents in upcoming days.

data science certification in bangalore
Robert steveson said…
This comment has been removed by the author.
Dwayne Dwayne said…
The article you have shared here about this topic is really significant for us. I'm happy that you have shared this great info with us. Keep posting, Thank you. Data Scientist Training Institute In Hyderabad
princika said…
I want to leave a little comment to support and wish you the best of luck.we wish you the best of luck in all your blogging enedevors.
data science training in chennai
Great to become visiting your weblog once more, it has been a very long time for me.

Pleasantly this article i've been sat tight for such a long time. I will require

this post to add up to my task in the school, and it has identical subject along

with your review. Much appreciated, great offer. data science course in nagpur


I was basically inspecting through the web filtering for certain data and ran over

your blog. I am flabbergasted by the data that you have on this blog. It shows how

well you welcome this subject. Bookmarked this page, will return for extra. data science course in jaipur
Extremely overall quite fascinating post. I was searching for this sort of data and delighted in perusing this one. Continue posting. A debt of gratitude is in order for sharing. data scientist course in delhi

Popular posts from this blog

Step by step Cordova calabash-ios automation

Measure the height of keyboard on PhoneGap app using jQuery