Re: JESS: Difference between dates

"ANA TANASESCU" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <21875_1283776171_o86CMAGQ022312_979976.92194.qm@web52004.mail.re2.yahoo.com>
Hallo Ernest,

I have discovered the bug. 
It was from tha java.uil.Date class. I have defined the dates using this class and the bug came from the second argument of the new  constructor  (year, month, day, hour, minutes). I thought I have defined the month August , but it was September (new Date(year-1900, month, day, hour, minutes). Therefore, I have substract 1 from the argument representing the month and I have solved the problem.

Ana

--- On Fri, 9/3/10, Ernest Friedman-Hill <[email protected]> wrote:

From: Ernest Friedman-Hill <[email protected]>
Subject: Re: JESS: Difference between dates
To: "jess-users" <[email protected]>
Date: Friday, September 3, 2010, 2:08 PM

I don't know how this could be; if you have a time difference in milliseconds, and you divide it by 86400000, you have a time difference in days. The number of days in a month does not enter into it at all.

On Sep 3, 2010, at 6:05 AM, ANA TANASESCU wrote:

> Hallo again,
> 
> I have read on JessWiki about working with Dates and I have found a few interesting functions. I need in my program to calculate the difference between two dates (number of days). Therefore, I have converted the date in milisecond, I have used the diff-time function (http://www.jessrules.com/jesswiki/view?DiffTime) and converted the result in days.
> First it seems to work, but if I use month like february it looks that this function considers that all months have 30 days.
> I thought that after converting in miliseconds I could use this function like datediff in ACCESS.
> What shall I do?
> 
> Best regards,
> Ana
> 
> 

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com







--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.