Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get date without time in existing momentjs object?

Let's say I have momentjs object like the following:

var date = moment(new Date(2014,2,17,9,60));

How could I get clone and get new momentjs object without time?

like image 754
Erik Avatar asked May 20 '14 11:05

Erik


1 Answers

With moment version 1.7 and above, just use startOf method.

var date2 = date1.clone().startOf('day');

See http://momentjs.com/docs/#/manipulating/start-of/

like image 159
yar0d Avatar answered Sep 28 '22 00:09

yar0d