Just to make sure environmental variables aren't getting messed with somehow,
try running this:
echo "console.log((new Date()).toLocaleString());" |
TZ='America/Los_Angeles' node
Should print out a locale string at GMT-0700 (PDT). If it doesn't, then I'd
defer to someone else who's more knowledgeable about the internals of Node's
Date object than myself. :)
-Matt
On Apr 9, 2012, at 2:32 PM, james33 wrote:
> I get GMT+0100 (PST) with that.
>
> On Monday, April 9, 2012 1:08:03 PM UTC-5, Matt wrote:
> And what if you pick a completely different timezone, e.g.,
> America/Los_Angeles?
>
> -Matt
>
> Sent from my iPhone
>
> On Apr 9, 2012, at 1:56 PM, james33 <[email protected]> wrote:
>
>> I still get the same result.
>>
>> On Monday, April 9, 2012 12:07:45 AM UTC-5, Matt wrote:
>> Hmm, European CST is GMT+1, it could be using that instead (in spite of the
>> US/ bit there). Try changing to (for example) 'America/Chicago' and see if
>> you get different results?
>>
>> -Matt
>>
>>
>> On Apr 9, 2012, at 12:49 AM, james33 wrote:
>>
>>> I'm running node 0.6.14 on a Joyent machine (OS is a varient of Solaris).
>>> The timezone is set to US/Central, but the Date object in node doesn't seem
>>> to recognize this. Below are the outputs of a few different console.logs:
>>>
>>> process.env.TZ: 'US/Central'
>>>
>>> new Date(): 'Mon, 09 Apr 2012 04:45:28 GMT'
>>>
>>> new Date().toLocaleString(): 'Mon Apr 09 2012 05:45:28 GMT+0100 (CST)'
>>>
>>> The current US/Central time is actually 'Sun Apr 08 2012 23:45:28 GMT -0500
>>> (CDT)'. Is this a bug or am I doing something wrong?
>>>
>>> --
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines:
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>>
>> --
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines:
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en