You can't right now.
Ideally, you should be able to set process.env.TZ = 'Europe/Amsterdam'
at startup and have it do the Right Thing but writes to process.env
don't update the real environment. This is trivially easy to fix but I
suppose no one has gotten around to it yet.
A workaround you can use is to restart the process with
child_process.spawn() and pass in a custom environment.
There is one minor difference with the original process.env in that
envvars without a '=' are not filtered. The original did so but I
believe that is actually a bug (or information hiding at the very
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nod...@googlegroups.com.
To unsubscribe from this group, send email to
For more options, visit this group at
I'm down with this, but it should have a test as it doesn't appear to
solve the problem:
> d = new Date()
Mon, 11 Oct 2010 17:59:41 GMT
> process.env.TZ = 'Europe/Amsterdam'
There are also some style issues - long line, bad indent.
TZ should be set before you call any date-related functions. I'll mail
the test tomorrow.
> There are also some style issues - long line, bad indent.
Sorry about that, I blame Eclipse. Attached is a patch with the style
Are there any coding guidelines? Line length, bracketing, that kind of thing?
Oh, right - tzset() won't be called again. Okay.
>> There are also some style issues - long line, bad indent.
> Sorry about that, I blame Eclipse. Attached is a patch with the style
> issues fixed.
> Are there any coding guidelines? Line length, bracketing, that kind of thing?
Attached is a patch that includes tests and fixes a bug caused by a
rather interesting and not terribly well-documented feature of V8's
named property handler support.
As Martha Stewart would say in that inimitable way of hers: "Unit
testing. It's a good thing."
 Deletion of properties didn't work. As it turns out, the query
callback needs to return an empty handle for deleted properties. That
is, Handle<Integer>() and not Handle<Integer>(Integer::New(0)).
In that case, you could just set the TZ right before getting the Date
string. Or, you could send a Date.now() epoch timestamp, and then
have a Date object on the client side turn that into a localized time
string. There are many ways to solve your problem, but I think
maintaining a per-request environment is an overly expensive approach.
This patch is still very helpful. process.env should be a real
interface to the environment, not just a snapshot.