Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [RESOLVED] Routine to convert current date/time to unix time

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[RESOLVED] Routine to convert current date/time to unix time
 Login/Join
 
Member
posted
Hi,

Is there anyone who has a routine to convert a date / time to unix time ?
example: 2016/04-07 11:02:00 --> 1460041320000

I have this piece of code, but it does not work at all time. Sometimes it returns 0 or 14400000

-* File TEST.fex
-SET &CVT_DATETIME = FPRINT(HGETC(8, 'HYYMDs'),'HYYMDS','A19');
-TYPE &CVT_DATETIME;
-INCLUDE convert_to_unixtime.fex
-RUN
-TYPE &CVT_UNIXTIME;


-* File convert_to_unixtime.fex

-DEFAULTH &CVT_DATETIME = _FOC_NULL;

-SET &OFFSET = HDIFF(HGETZ(8,'HYYMDs'),HGETC(8,'HYYMDs'),'HOUR','D6.2');
-SET &STARTDATE_HYYMDS = HINPUT(19, &CVT_DATETIME, 8, 'HYYMDS');
-SET &STARTDATE_GMT = HADD(&STARTDATE_HYYMDS, 'HOURS', &OFFSET , 8, 'HYYMDS');
-SET &BASEDATE_HYYMDS=HINPUT(19, '1970-01-01 00:00:00', 8, 'HYYMDS');
-SET &CVT_UNIXTIME = LJUST(20,FTOA(HDIFF(&STARTDATE_GMT,&BASEDATE_HYYMDS,'ss','D20') * 1000 , '(D20c)', 'A20'), 'A20');


thank,

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


WebFOCUS 8.1.5
Windows, All Outputs
 
Posts: 16 | Registered: July 23, 2015Report This Post
Virtuoso
posted Hide Post
You might want to do this in a TABLE request instead of Dialogue Manager. Try something like this.
DEFINE FILE CAR
BASE_DT/HYYMDS=DT(19700101);
TODAY_DT/HYYMDS=DT(20160407);
UNIX_TM/I9=(HDIFF(TODAY_DT ,BASE_DT, 'DAY', 'D12.2'))* 86400 ;
END
TABLE FILE CAR
PRINT TODAY_DT UNIX_TM
BY COUNTRY
END


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Expert
posted Hide Post
Create a DEFINE FUNCTION, then it can be called from TABLE or DM.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
I usually do such conversions by querying one of our connected RDBMSes. Those tend to have the appropriate functions readily available, including time zone and DST conversions, whereas WebFOCUS has nothing of the sort.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Member
posted Hide Post
Hi,

With the DEFINE FUNCTION it work fine every time.

Thank for your help


WebFOCUS 8.1.5
Windows, All Outputs
 
Posts: 16 | Registered: July 23, 2015Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [RESOLVED] Routine to convert current date/time to unix time

Copyright © 1996-2020 Information Builders