'Get the current date using date-fns in ISO-8601 format
I want to get a ISO-8601 format of last hour:minute:secounds from the current day using date-fns lib:
I'm using:
endOfDay(new Date());
Fri Sep 14 2018 23:59:59 GMT-0300
So add toISOString() to get it in ISO format:
endOfDay(new Date()).toISOString()
Result:
2018-09-15T02:59:59.999Z
When I need:
2018-09-14T23:59:59.999Z
Solution 1:[1]
format(endOfDay(new Date()), "yyyy-MM-dd'T'HH:mm:ss'Z'")
This method worked for me
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Srinivasan Mohan |
