Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'd like to configure some of my notebooks to assume all calculations using dates, times and locations (notably AstronomicalData , but others too) take place at the Greenwich Observatory.

I know I can achieve this by unprotecting $TimeZone and setting it to 0, as with

    $GeoLocation = {51.476786, 0.00000000};
    Unprotect[$TimeZone];
    $TimeZone = 0;
    Protect[$TimeZone];

but worry that this might have some other consequences that would confuse date and time functions.

Is it safe to do this? Does changing the value of $TimeZone have side effects I should avoid?

share|improve this question
    
Can't you put it in a Block? In any case, I don't see any side effects, other than some date conversions and W|A calls getting messed up. –  rm -rf Dec 4 '12 at 22:35
    
@rm-rf: Block, if you mean Block[{$TimeZone=0}, ...], wasn't working for me for some functions, at least not DateList]. Also, I'd prefer to make the change global, rather than have to remember to make the change each time I do something that depends on it. –  raxacoricofallapatorius Dec 4 '12 at 22:39
    
Why not use TimeZone? That's what is seems to be for. E.g. Table[DateString[TimeZone -> i], {i, 0, 6}] from the documentation. –  David Carraher Dec 4 '12 at 22:43
    
@DavidCarraher: All calculations, globally. Forgetting to do that just once could really mess things up, and that's what I'm trying to avoid. –  raxacoricofallapatorius Dec 4 '12 at 22:46
    
@rm-rf: Hmmm... Block may not work, simply because DateList looks broken. Try $TimeZone=0 and then DateList[...,TimeZone->0]. That should leave the date given unchanged, but (if you're machine timezone isn't 0) it won't. I may not even be able to do what I want with a global change of $TimeZone. –  raxacoricofallapatorius Dec 4 '12 at 22:59
show 1 more comment

1 Answer

As the Locale & Internalization guide page says $TimeZone is resettable.

Mathematica graphics

If the developers would foresee adverse effects I guess they wouldn't have documented it in this way. The only problem that I can see is that you have to take care that your system time is also set to GMT, otherwise real-time calculations (e.g., elevation of the sun as seen in Greenwich at the time of evaluation) will give the incorrect result.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.