Bikeman17 Posted January 5, 2006 Posted January 5, 2006 Hi I would like to substrack two dates and get the result in number. Something like 04/01/2006 - 01/01/2006 = 4 Thanks
Raybaudi Posted January 5, 2006 Posted January 5, 2006 Hi the two dates are into two date fields ? If so, the calc is: date2 - date1 + 1 or, if you don't know wich is the greatest: Abs(date2 - date1) + 1
Bikeman17 Posted January 5, 2006 Author Posted January 5, 2006 I try to substract the current day which is a calc and a date field. I end up with a weird result.
Raybaudi Posted January 5, 2006 Posted January 5, 2006 Your current day calc ( = Get ( CurrentDate ) ) must be UNSTORED
Matt Klein Posted January 5, 2006 Posted January 5, 2006 Hi I would like to substrack two dates and get the result in number. Something like 04/01/2006 - 01/01/2006 = 4 Thanks Well, you can create a calculation field whose result is a Number and basically use the equation you wrote. Assuming the dates are in two fields it would be as simple as: Date2 - Date1 However, this will return the number of days not the number of months as it appears that you are looking for. You could then try: Truncate((date2 - date1)/30,0) This basically takes the number of days between the two dates and divides it by an estimated number of days per month. Then, the Truncate function just drops the numbers to the right of the decimel. You could leave the Truncate function of if you want the exact number of months. It should be noted though that using the above calculation using the two dates that you used in your post would not return 4. It would return 3.
Raybaudi Posted January 5, 2006 Posted January 5, 2006 I think that Bikerman17 is using the format: DDMMYYYY (international) Isn't so, Bikerman ?
Matt Klein Posted January 5, 2006 Posted January 5, 2006 I think that Bikerman17 is using the format: DDMMYYYY (international) Isn't so, Bikerman ? That would explain it. Sorry. I was looking at it from a U.S. perspective. Either way though, you would have add 1 to the result like Daniele did in an earlier post.
Raybaudi Posted January 5, 2006 Posted January 5, 2006 I try to substract the current day which is a calc and a date field. I end up with a weird result. Please, give us an example of those "weird result"
Bikeman17 Posted January 5, 2006 Author Posted January 5, 2006 Yes I am using the internationnal format but it doesn't matter. I got -86.
Raybaudi Posted January 5, 2006 Posted January 5, 2006 Please, check your fields definitions... date1 must be a date date2 must be a calc (result date) = GetCurrentDate Difference must be a calculation (result number)
Bikeman17 Posted January 5, 2006 Author Posted January 5, 2006 Perhaps I am missing something, attach a sample to your next reply. I'd like to see that in detail.
Raybaudi Posted January 5, 2006 Posted January 5, 2006 Here it is ! P.S. I have added some "case" statement, so if the date is empty, the calc don't evaluate. DateDifference.zip
Bikeman17 Posted January 5, 2006 Author Posted January 5, 2006 Basically, that's what I did but in my file the result is 87. I pasted your calc and got the same result. My date format is DDMMYYYY but I never encountered any limitations in dealing with date string calculations. Anyway I manage to use your file in relationship with another one. Thank you
Recommended Posts
This topic is 6962 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now