Skip to content

Tag: datetime

Convert Epoch timestamp to ISO in javascript

I have a function in Java to convert an Epoch date to ISO 8601, but I’ve come across the need to do it in Javascript. I have it somewhat working in JS but it needs to be localized to the timezone. Java version: Param1: -157737600000 Param2: PST Output: 1965-01-01T00:00:00-08 My attempt in Javascript: Essentially I want the same thing that’s

Dates stuck in month loops

The dates go to one month either side and then get stuck in loops. Starting in June, it will go fine to end of July, or start of May, but then loop back to the end/start of those months instead of going further. globalDate is a React state defined const [globalDate, setGlobalDate] = useState(new Date()); Code Snippet: Full page source