cancel
Showing results for 
Search instead for 
Did you mean: 

How to find out the local DB's time zone

Former Member
0 Kudos

I need to find local DB's time zone just like "SessionTimeZone" in Oracle, how can I get from HANA SQL?

The reason I need it since I have UTC timestamp and needs to convert it to local timestamp.  UTCTOLOCAL function needs to provide a timezone string.  Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

lbreddemann
Active Contributor
0 Kudos

Mind using the SCN search?

In I described how to find the server's timezone.

Cheers,

Lars

Former Member
0 Kudos

Thanks.  I got this from the following SQL:

select VALUE from M_HOST_INFORMATION where upper(KEY) like '%TIMEZONE_NAME%';

lbreddemann
Active Contributor
0 Kudos

That's what I wrote in my blog, yes.

But since you now the key_name you might also use the equal operator .

Former Member
0 Kudos

Yes. However I found another serious problem with HANA's UTCTOLOCAL function. It doesn't recognize timezone string of 'PDT' which I got from one HANA instance run by Vancouver team. The function only inputs "PST'. 

lbreddemann
Active Contributor
0 Kudos

Did you load the timezone definition tables?

The bare bone SAP HANA installation only comes with a limited and unfortunately undocumented set of timezone definitions. So loading the time zone tables is required.

- Lars

Former Member
0 Kudos

Thanks Lars.

However I have a serious problem now.  I need to convert a UTC timestamp to a Local DB's timestamp with SQL.  I found UTCTOLOCAL(t, timezone) function which requires me to enter 'timezone' string. And I retrieved it from M_HOST_INFORMATION, but that value like 'PDT' is not supported in the UTCTOLOCAL function. how can I solve it?  

lbreddemann
Active Contributor
0 Kudos

Did you read my last reply?

Former Member
0 Kudos

yes, I found the solution. Instead of get timezone_name, I use timezone_offset. 

Answers (0)