Skip to content
Advertisement

get time intervals with time range

I am trying to get time interval with custom start and end time variables for which i have searched and find its relevant information on this link.

I have tried the following code but its giving errorUncaught Error: Call to a member function date() on string

JavaScript

Advertisement

Answer

You need to use the builtin DateTime class and the DateInterval class as well

JavaScript

RESULTS

JavaScript

And if the time roles over to another day something like this

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement