Okay, so the question sounds kind of weird, but here's the problem.
I have used an api to get the weather forecast. The date and time is stated as a string, e.g. 2022-09-14 21:00, and the forecast is given with three hours intervals. So the first forecast is 2022-09-14 18:00, then the next forecast is 2022-09-14 21:00.
Then I created a date variable to get the current date, and passed it so it has the same format as the forecasts that is given, so the current date and time is currently, when writing 2022-09-14 16:00. All of that sorted, I now want to have a function to round up the date and time to get the forecast 2022-09-14 18:00.
Is there any way to do this?
I am pretty sure this can't be done with strings, so maybe it is possible to get the position of e.g. "18" and then convert that to a integer? I am quite new to coding in javascript, so please have patients.
Thats all, thanks!