Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  70] [ 5]  / answers: 1 / hits: 8367  / 6 Years ago, thu, february 8, 2018, 12:00:00

To get the current time in UTC format, I can use



moment.utc().format(YYYY-MM-DD HH:mm:ss);


Now, in Moment.js, how do I get the time in the same format but 24 hours before that?


More From » momentjs

 Answers
11
moment.utc().subtract(1,day).format(YYYY,MM-DD HH:mm:ss);


or



moment.utc().subtract(24,hours).format(YYYY,MM-DD HH:mm:ss);

[#15333] Tuesday, February 6, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ellisc

Total Points: 533
Total Questions: 82
Total Answers: 90

Location: Bangladesh
Member since Thu, Aug 5, 2021
3 Years ago
;