Learning SAS? Welcome to the exclusive online community for all SAS learners.

Timezone in VirtualBox VM?

Accepted Solution Solved
Reply
Contributor
Posts: 31
Accepted Solution

Timezone in VirtualBox VM?

When I get timestamps they are in the wrong timezone.

How to change the timezone of the vm?


Accepted Solutions
Solution
‎12-12-2014 10:55 AM
SAS Employee
Posts: 147

Re: Timezone in VirtualBox VM?

Sorry for the delay.  We were experimenting with several options but it looks like the clearest, most direct way is to use the TIMEZONE system option in your SAS code.  So if you were in Tokyo, then you'd add this statement to the beginning of your SAS code:

options timezone='Asia/Tokyo';


The doc on this is at SAS(R) 9.4 National Language Support (NLS): Reference Guide, Third Edition   and the specific list of values for the value of timezone is at SAS(R) 9.4 National Language Support (NLS): Reference Guide, Third Edition .   You can add the TIMEZONE option to all of your code, or you can just put it in your SAS autoexec so it's run for you each time you start SAS Studio. 

To edit the autoexec.sas file:

  1. Click More application options button (where your preferences are in the upper right corner of SAS Studio) and select Edit Autoexec File.

  2. Enter the code that you want to include in the autoexec.sas file.

  3. To validate your syntax, click Run. The Log tab opens so that you can view the log.

  4. Click Save to save and close the autoexec file.


View solution in original post


All Replies
SAS Employee
Posts: 147

Re: Timezone in VirtualBox VM?

Can you provide a bit more information on where you're seeing incorrect time stamps?  In page headings of generated output?  Results from SAS function calls?  A snippet of code or output would help narrow this down.

Thanks!

Contributor
Posts: 31

Re: Timezone in VirtualBox VM?

Here is a sample code:

data beisp;

jetzt=time();

run;

proc print data=beisp;

format jetzt time9.4;

run;

and here is a screenshot:

my local time is 23:44  // the time() gives 17:44

time_in_vm.png

Super User
Posts: 19,861

Re: Timezone in VirtualBox VM?

In VMWare Fusion, in the settings there's an option to synchronize time.

Check the settings in VirtualBox (Oracle?) to see if there's something similar?

Contributor
Posts: 31

Re: Timezone in VirtualBox VM?

It seems not to be a problem of synching the time. More a problem of time zone.

But how to handle this?

Solution
‎12-12-2014 10:55 AM
SAS Employee
Posts: 147

Re: Timezone in VirtualBox VM?

Sorry for the delay.  We were experimenting with several options but it looks like the clearest, most direct way is to use the TIMEZONE system option in your SAS code.  So if you were in Tokyo, then you'd add this statement to the beginning of your SAS code:

options timezone='Asia/Tokyo';


The doc on this is at SAS(R) 9.4 National Language Support (NLS): Reference Guide, Third Edition   and the specific list of values for the value of timezone is at SAS(R) 9.4 National Language Support (NLS): Reference Guide, Third Edition .   You can add the TIMEZONE option to all of your code, or you can just put it in your SAS autoexec so it's run for you each time you start SAS Studio. 

To edit the autoexec.sas file:

  1. Click More application options button (where your preferences are in the upper right corner of SAS Studio) and select Edit Autoexec File.

  2. Enter the code that you want to include in the autoexec.sas file.

  3. To validate your syntax, click Run. The Log tab opens so that you can view the log.

  4. Click Save to save and close the autoexec file.


SAS Super FREQ
Posts: 709

Re: Timezone in VirtualBox VM?

Hi Amy

Many thanks, using

options

  timezone = "Europe/Zurich"

;

works wonders for me

Contributor
Posts: 31

Re: Timezone in VirtualBox VM?

Hi Amy, yes this works fine!

Thank you.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 1019 views
  • 1 like
  • 4 in conversation