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     [SOLVED] Converting a Date to Epoch Time and DATEDIF

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Converting a Date to Epoch Time and DATEDIF
 Login/Join
 
Silver Member
posted
Hi,

I am having the hardest time converting a date to epoch time. I even tried using datedif to get the difference in days so that I can just multiply it out to get seconds but the results I am getting are completely wrong.

My datedif code looks like this:

DATEDIF(19700101,20120423,'D').

Shouldn't that return me the differnce in days? But what it seems to be doing is just giving me the difference between the numbers. What could I be doing wrong here? I am probably missing something completely obvious.

If anyone can help me convert a date to epoch time or help me understand why my DATEDIF function isn't working. I would appreciate it.

Thanks ahead of time.
-Prince

This message has been edited. Last edited by: Prince Joseph,


Webfocus 8, All Outputs

 
Posts: 47 | Location: Atlanta, GA | Registered: June 09, 2011Report This Post
Virtuoso
posted Hide Post
Try putting single quotes around your dates so DATEDIF knows you are providing dates instead of numbers. If you use date-time values instead, you can use function HDIFF to calculate the number of seconds between the two values.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Silver Member
posted Hide Post
Thanks for the help. I'll definitely try this.


Webfocus 8, All Outputs

 
Posts: 47 | Location: Atlanta, GA | Registered: June 09, 2011Report This Post
Virtuoso
posted Hide Post
You're going to run into DST and time zone offset problems with that approach, as timestamps are based in UTC (no DST), while your local time zone probably does do DST and has an offset.

I dealt with a similar issue in this post: http://forums.informationbuild...1057331/m/4487079816

Apparently there's no way in WebFOCUS to calculate the offset you need, but it's possible to ask a database you're connecting to (doesn't even matter much which one).

It suffices to figure out the offset between a date in your local time zone (DST or not) and the same date in GMT.


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
Silver Member
posted Hide Post
Thanks for the help guys. I was able to finally figure it out. We have a method in place to get the offset time.


Webfocus 8, All Outputs

 
Posts: 47 | Location: Atlanta, GA | Registered: June 09, 2011Report 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     [SOLVED] Converting a Date to Epoch Time and DATEDIF

Copyright © 1996-2020 Information Builders