I need to convert time from DATE format to NUMBER format (number of seconds). I will try to explain with a picture (the image is simulated using input).
You can convert a javascript Date object to a milliseconds timestamp using let sunrise = theDate.getTime()
It looks as if you are trying to get the number of seconds since the start of the day, in which case you first need to get the number of ms since the start of the day, by taking the modulus with 24 hours in ms sunrise = sunrise % (24 * 3600000)
Then divide by 1000 to get seconds.
However, that seems a slightly unusual thing to need, can you explain why you need that?