Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
184
rated 0 times [  191] [ 7]  / answers: 1 / hits: 24042  / 10 Years ago, tue, may 20, 2014, 12:00:00

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?


More From » date

 Answers
17

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/


[#70938] Saturday, May 17, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
terrence

Total Points: 120
Total Questions: 115
Total Answers: 87

Location: England
Member since Fri, May 22, 2020
4 Years ago
terrence questions
Sat, Jun 5, 21, 00:00, 3 Years ago
Wed, Jun 17, 20, 00:00, 4 Years ago
;