RuntimePackage ManagerBundlerTest RunnerLinterFormatterGuidesReferenceBlogFeedback

Set a time zone in Bun

Bun supports programmatically setting a default time zone for the lifetime of the bun process. Set the TZ environment variable to a valid time zone identifier.

process.ts
process.env.TZ = "America/New_York";

You can also set TZ on the command line when running a Bun command.

terminal
TZ=America/New_York bun run dev

Once TZ is set, every Date instance uses that time zone.

process.ts
new Date().getHours(); // => 18

process.env.TZ = "America/New_York";

new Date().getHours(); // => 21