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] Date to miliseconds conevrsion

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Date to miliseconds conevrsion
 Login/Join
 
Member
posted
Hi , I have a requirement where te date format yyyy-mm-dd should be converted to milliseconds. I tried using htime but it is giving me wrong result. Please let me know the function tat wud solve my issue.

This message has been edited. Last edited by: Kerry,
 
Posts: 7 | Registered: April 12, 2011Report This Post
Expert
posted Hide Post
How does one convert a particular date to milliseconds? Milliseconds is a duration.

I can tell you how many milliseconds are in one day (1 day = 24 hours = 86,400,000 milliseconds), I can tell you how many milliseconds there are in 24 June, 2011, the same number as in 17 February, 1993 - every day has the same number of milliseconds.

I can tell you how many milliseconds there are between 5 August 2003 and 14 April 2011 - is that what you're looking for?


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Well this hasn't happened in forever. Welcome LMP - wonder why you did not have to put what version you are using. Thought that was a requirement when registering......


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
Member
posted Hide Post
Sorry if my question was wrong.

I am doing a Java rewrite to Web focus.

In java the milliseconds of a date is retrieved using Date.getTime() function. The input to this function is a date of format yyyy-mm-dd.
I am expecting something similar in webfocus.

By the way i am using WF version 7.6.9

Thanks,
LMP


7.6.9, Windows
Excel and HTML
 
Posts: 7 | Registered: April 12, 2011Report This Post
Expert
posted Hide Post
Give me an example of a result of the Date.getTime() function.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
http://download.oracle.com/jav.../java/util/Date.html

getTime() Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this Date object.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
the input date given is 2011-04-13

and the o/p got was 1302494520000.

Thanks,
LMP


7.6.9, Windows
Excel and HTML
 
Posts: 7 | Registered: April 12, 2011Report This Post
Expert
posted Hide Post
Try something like this:

-* File datedif2.fex

-SET &ECHO=ALL;

DEFINE FILE CENTORD
HDTTM0/HYYMDs = HINPUT(14,'19700101000000', 8, 'HYYMDs');
HDTTM1/HYYMDs = HDTTM(ORDER_DATE, 8, 'HYYMDs');
HDIFF_MS/D15  = HDIFF(HDTTM1, HDTTM0, 'millisecond', 'D15');
END

TABLE FILE CENTORD
PRINT
HDTTM0
HDTTM1
HDIFF_MS
END


You may have to adjust 1970/01/01 00:00:00 by four hours because Java is based on GMT - just compare a date to the results in your Java program.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
-* File datedif2.fex

-SET &ECHO=ALL;

DEFINE FILE CENTORD
HDTTM0/HYYMDs = HINPUT(14,'19700102200000', 8, 'HYYMDs');
HDTTM1/HYYMDs = HINPUT(14,'20110413000000', 8, 'HYYMDs');
-*HDTTM1/HYYMDs = HDTTM(ORDER_DATE, 8, 'HYYMDs');
HDIFF_MS/D15  = HDIFF(HDTTM1, HDTTM0, 'millisecond', 'D15');
END

TABLE FILE CENTORD
PRINT
HDTTM0
HDTTM1
HDIFF_MS
BY ORDER_DATE
WHERE RECORDLIMIT EQ 1
END


For some reason, the base date needs to be near 1970/01/02/20:00:00 to get close to your value of 1,302,494,520,000. My code gives 1,302,494,400,000. So the base date needs to be tweaked by some minutes...


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Member
posted Hide Post
Hi Francis,

Thanks a lot. Tat worked. Now i want to convert milliseconds obtained back to a Timestamp .ie date and time.

I am completely new to WF. Hence the struggle. Searched the forum.. but cudnt find one.

Please let me know how to convert the ms to date-time.


7.6.9, Windows
Excel and HTML
 
Posts: 7 | Registered: April 12, 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] Date to miliseconds conevrsion

Copyright © 1996-2020 Information Builders