javascript - Deprecation warning: moment construction falls back to js Date -


i attempting convert datetime

150423160509 //this utc datetime

to following format:

2015-04-24 00:05:09 //local timezone

by using moment.js

var moment = require('moment-timezone');   var = moment.tz('150423160509', "asia/taipei"); console.log( a.format("yyyy-mm-dd h:m:s") ); 

but gives me error

deprecation warning: moment construction falls js date. discouraged , removed in upcoming major release 

you need tell moment how parse date format, this:

var parseddate = moment.utc("150423160509", "yymmddhhmmss"); var = parseddate.tz("asia/taipei");  // i'm assuming meant hh:mm:ss here console.log( a.format("yyyy-mm-dd hh:mm:ss") ); 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -