I am getting the current utc time as let time = moment.utc() and I need to check if this time is between '04:30:00' and '16:30:00' both time in utc. But I cannot format the time as moment.isBetween doesn't accept string. How to check if my current time is between those two values ?
Asked
Active
Viewed 129 times
-1
-
get the time from `time` in format `hh:mm:ss` ... then do a string comparison .. since, for example, `"09:30:00" > "04:30:00"` and `< "16:30:00"` - that would be the simplest solution in my opinion – Jaromanda X Oct 12 '22 at 07:53
1 Answers
0
this solution may help you How can I compare two time strings in the format HH:MM:SS?
You just need to convert this utc time to simple time than compare them.
convert utc : moment().utc().format('hh:mm:ss')

malik haider
- 29
- 4