Focal Point
[SOLVED] Getting TimeZone from a Date

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/456103445

October 08, 2010, 11:45 AM
JimBowe
[SOLVED] Getting TimeZone from a Date
I am in need of getting the Timezone(AST) portion of -SET &DATEDISP = '10/08/2010 11:11:06 AST';

I am not having much luck finding on how to do this. Did I miss it in the knowledge base? I see how to use HCNVRT but I can't find how to get the TimeZone. Any ideas?

This message has been edited. Last edited by: Kerry,


Jim
Prod: WebFOCUS 7.6.5 CGI - Self Service - AIX 5.2 - IBM DB2 V9
Env 3 Local: DevStudio 7.6.5 Servlet - Self Service - MS Windows XP SP2 - Output: HTML, Excel 2000 and PDF
October 08, 2010, 01:27 PM
GinnyJakes
Try this:
-SET &TZ=EDIT(&DATEDISP,'$$$$$$$$$$$$$$$$$$$$$999');

Or you can use SUBSTR.

Hopefully I didn't misunderstand your question.


Ginny
---------------------------------
Prod: WF 7.7.01 Dev: WF 7.6.9-11
Admin, MRE,self-service; adapters: Teradata, DB2, Oracle, SQL Server, Essbase, ESRI, FlexEnable, Google
October 08, 2010, 01:37 PM
Francis Mariani
Jim, if you're doing this in Dialogue Manager, you can use the EDIT or SUBSTR function to extract the 21st to the 23rd character of the date-time string.

But, I imagine your need is more complex than this, so please provide more details.

Thanks,


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 08, 2010, 01:41 PM
Francis Mariani
Like Ginny posted, 10 minutes before me!


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 08, 2010, 04:08 PM
GamP
Jim,
If you need to get the time zone from a db2 datetime field (or any other dbms for that matter), then sorry, there is no part of the field that indicates a time zone. As far as I know, the only dbms that sort of supports time zones is Oracle. DB2 stores (and returns) dates in the time zone that it derives from the OS where the database resides.
From the internet I got this statement to get DB2 to print the current local time in utc format:
db2 "with t (local_time, utc_time) as ( values (current_timestamp, current_timestamp - current timezone) ) select * from t"
Maybe you can convert this to something that WebFOCUS can handle - if this is what you're looking for. If not, just ignore this post.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
October 10, 2010, 03:47 PM
Waz
Another option for Dialog Manager or an alpha field is to use GETTOK with a -1 as the token number.

I think more info on the source and format of the data will help.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

October 11, 2010, 08:51 AM
JimBowe
Ginny
You hit it right on the head.

Thank you


Jim
Prod: WebFOCUS 7.6.5 CGI - Self Service - AIX 5.2 - IBM DB2 V9
Env 3 Local: DevStudio 7.6.5 Servlet - Self Service - MS Windows XP SP2 - Output: HTML, Excel 2000 and PDF
October 11, 2010, 05:44 PM
T.Peters
What type of data are you querying? Does your record have any sort of physical location information you can pull? If so, then maybe you can build a work file that lists the time zones for different physical locations and do a DB_LOOKUP on that table?


WebFOCUS: 7702
O/S : Windows
Data Migrator: 7702