'JS - Convert a "Europe/Berlin"-Date into a UTC-Timestamp
Inside my Docker-Container, which has the timezone Etc/UTC
, I need to convert a Date-String which represents a Date in Europe/Berlin
-timezone into a UTC timestamp.
So lets say the Europe/Berlin
-Date is 2022-04-20T00:00:00
.
Now the UTC-Timestamp should be equivalent to 2022-04-19T22:00:00
.
But when I do
console.log(new Date("2022-04-20").getTime())
I get 1650412800000
which is equivalent to 2022-04-20T02:00:00
in Europe/Berlin
-timezone.
How would I do this?
Edit:
I tried various libs, but still cant get that managed
const { DateTime } = require("luxon")
var f = DateTime.fromISO("2022-04-20").setZone('Europe/Berlin').toUTC()
console.log(f)
also the equivalent stamp in f
is 2022-04-20T02:00:00
:/
Solution 1:[1]
Start with something like this:
IFERROR(FIND(A1,B1,1),NA())
you could then add an if() and concatenate C to F like this:
=if(IFERROR(FIND(A1,B1,1),NA())>0,C1&D1&E1&F1,"")
But only a guess since there is no example data.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Solar Mike |