Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
352 views
in Technique[技术] by (71.8m points)

javascript - 用moment.js解析字符串到目前为止(Parse string to date with moment.js)

我想用moment.js 2014-02-27T10:00:00和输出日月份(2014年3月14日)解析以下字符串我一直在阅读文档但没有成功http://momentjs.com/docs/# /分析/现在/

  ask by reachify translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I always seem to find myself landing here only to realize that the title and question are not quite aligned.

(我似乎总是发现自己落在这里只是为了意识到标题和问题并不完全一致。)

If you want a date object from a string :

(如果你想要一个字符串的日期对象 :)

const myDate = moment(str, 'YYYY-MM-DD').toDate();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...