Moment.js - how do I build moment from date and time string?

前端 未结 2 1764
广开言路
广开言路 2021-01-03 19:21

If I have given date string MM-DD-YYYY and time string HH:mm A or H:m a, how do I build a moment object?

I tried

2条回答
  •  耶瑟儿~
    2021-01-03 19:39

    Try using the format (second) parameter moment("12-25-1995", "MM-DD-YYYY");

    For details see http://momentjs.com/docs/#/parsing/string-format/

提交回复
热议问题