Subj : Run JS with a different TZ To : nelgin From : Digital Man Date : Fri Oct 13 2023 09:06 pm Re: Run JS with a different TZ By: nelgin to Digital Man on Fri Oct 13 2023 06:57 pm > 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) > > Right, which gives a result in central time. I want the result in eastern > time, as per: > > TZ="America/New_York" jsexec '-r Date("2023-10-13T23:30:00Z")' > Result (string): Fri Oct 13 2023 19:55:42 GMT-0400 (EDT) > > However, there's no way to set TZ before executing the script from the xtrn > section since I'm not calling jsexec. Right. And environment variables are shared among on threads (e.g. nodes) of the sbbs instance, so even if you could set the TZ environment variable, you'd be changing for all threads. Likely not what you want. There's a whole new JS Date thing in the works for some future version of JavaScript, but that'll be aways away from being integrated with sbbs. I think the easiest thing to do would be to adjust the UTC value based on the UTC offset for central time (yeah, it'll change with DST) and then use Date.toUTCString() to convert it to a string. -- digital man (rob) Rush quote #87: Shifting shafts of shining weave the fabric of their dreams .. Jacob's Ladder Norco, CA WX: 66.1øF, 75.0% humidity, 0 mph SSW wind, 0.00 inches rain/24hrs .