Reputation: 5135
I am using moment.js and I want to convert my string date into time.
I am getting the date in this format: Apr 01
and I want the output like 2017-01-01T00:00:00+05:00
.
How can I achieve this?
Upvotes: 1
Views: 3637
Reputation: 31482
Simply use moment(String, String)
and format()
method.
Here a working sample:
console.log(moment('Apr 01', 'MMM DD').format());
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
Upvotes: 5