How can I remove time from date with Moment.js?
Sorry to jump in so late, but if you want to remove the time portion of a moment()
rather than formatting it, then the code is:
.startOf('day')
Use format('LL')
Depending on what you're trying to do with it, format('LL')
could do the trick. It produces something like this:
Moment().format('LL'); // => April 29, 2016
The correct way would be to specify the input as per your requirement which will give you more flexibility.
The present definition includes the following
LTS : 'h:mm:ss A', LT : 'h:mm A', L : 'MM/DD/YYYY', LL : 'MMMM D, YYYY', LLL : 'MMMM D, YYYY h:mm A', LLLL : 'dddd, MMMM D, YYYY h:mm A'
You can use any of these or change the input passed into moment().format().For example, for your case you can pass moment.utc(dateTime).format('MMMM D, YYYY')
.