Subj : Run JS with a different TZ To : nelgin From : Charles Blackburn Date : Sat Oct 14 2023 10:58 am Re: Run JS with a different TZ By: nelgin to Digital Man on Fri Oct 13 2023 18:57:42 > Re: Run JS with a different TZ > By: Digital Man to nelgin on Fri Oct 13 2023 13:33:06 > > > Okay, so if it's in UTC, it's in central *or* eastern US. It's UTC. > > > Example: > > jsexec '-r Date("2023-10-13T23:30:00Z")' > > jsexec '-r Date("2023-10-13T23:30:00Z")' > Result (string): Fri Oct 13 2023 18:54:33 GMT-0500 (CDT) if you know it's in UTC format then something like this should work (first result from google) https://stackoverflow.com/questions/10087819/convert-date-to-another-timezone-in-javascript ##### code from the above url function convertTZ(date, tzString) { return new Date((typeof date === "string" ? new Date(date) : date).toLocaleString("en-US", {timeZone: tzString})); } // usage: Asia/Jakarta is GMT+7 convertTZ("2012/04/20 10:10:30 +0000", "Asia/Jakarta") // Tue Apr 20 2012 17:10:30 GMT+0700 (Western Indonesia Time) // Resulting value is regular Date() object const convertedDate = convertTZ("2012/04/20 10:10:30 +0000", "Asia/Jakarta") convertedDate.getHours(); // 17 // Bonus: You can also put Date object to first arg const date = new Date() convertTZ(date, "Asia/Jakarta") // current date-time in jakarta. charlie --- þ Synchronet þ My Brand-New BBS .