Re: Run JS with a different TZ
By: nelgin to Charles Blackburn on Sat Oct 14 2023 22:09:23
Re: Run JS with a different TZ
By: Charles Blackburn to nelgin on Sat Oct 14 2023 10:58:43
function convertTZ(date, tzString) {
return new Date((typeof date === "string" ? new Date(date) : date).toLocaleString("en-US", {timeZone: tzString}));
}
You did actually try this and discovred it doesn't actually work, right?
can't say i did, i'm not a jS programmer, but was just throwing an idea out. but there should be a way to do it. In C/Python you can do it
in a similar way. if the string is in UTC you should be able to internally convert it to whatever TZ you want.
Charlie
---
þ Synchronet þ My Brand-New BBS