rembrembdocs

Skip to main content

Bun home pagelight logodark logo

[Runtime

](../../../index.md)[Package Manager

](../../../pm/cli/install/index.md)[Bundler

](../../../bundler/index.md)[Test Runner

](../../../test/index.md)[Guides

](../../index.md)[Reference

](https://bun.com/reference)[Blog

](https://bun.com/blog)[Feedback

](../../../feedback/index.md)

Bun supports programmatically setting a default time zone for the lifetime of the bun process. To do set, set the value of the TZ environment variable to a valid timezone identifier.

When running a file with bun, the timezone defaults to your system’s configured local time zone.When running tests with bun test, the timezone is set to UTC to make tests more deterministic.

https://mintcdn.com/bun-1dd33a4e/JUhaF6Mf68z_zHyy/icons/typescript.svg?fit=max&auto=format&n=JUhaF6Mf68z_zHyy&q=85&s=7ac549adaea8d5487d8fbd58cc3ea35bprocess.ts

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

Alternatively, this can be set from the command line when running a Bun command.

terminal

TZ=America/New_York bun run dev

Once TZ is set, any Date instances will have that time zone. By default all dates use your system’s configured time zone.

https://mintcdn.com/bun-1dd33a4e/JUhaF6Mf68z_zHyy/icons/typescript.svg?fit=max&auto=format&n=JUhaF6Mf68z_zHyy&q=85&s=7ac549adaea8d5487d8fbd58cc3ea35bprocess.ts

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

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

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

Was this page helpful?

Suggest editsRaise issue

[

Run a Shell Command

Previous

](../shell/index.md)[

Set environment variables

Next

](../set-env/index.md)