IBM Support

How to display the date / time (timestamp) recorded in query history database in my local timezone ?

Question & Answer


Question

How to display the date / time (timestamp) recorded in query history database in my local timezone ?

Cause

In the System Administration guide, Chapter 11-3 mentioned: "Note: Netezza saves the dates and times for the activity in the history database in GMT format."

How can I then, display the dates / times (timestamp) in my local time?

Answer

If you wish the date / time to be displayed in local time, you can consider the following methods:-

For example,
HISTDB.TEST(ADMIN)=> select max(SUBMITTIME) from "$v_hist_queries";
MAX
----------------------------
2014-04-04 19:55:56.295609 <- GMT
(1 row)

Method 1: Change it to the local time using global timezone offset :-
HISTDB.TEST(ADMIN)=> select max((submittime + (SELECT TZOFFSET FROM _VT_PG_TIME_OFFSET))) from "$v_hist_queries";
MAX
----------------------------
2014-04-04 15:55:56.295609 <- This should then be in your local time
(1 row)

Method 2: Change it to the local time by minus the time different :-
HISTDB.TEST(ADMIN)=> select max(submittime) - interval '4 hours' as MAX from "$v_hist_queries";
MAX
----------------------------
2014-04-04 15:55:56.295609
(1 row)

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
17 October 2019

UID

swg21669460