FIELD Date1:=Date1;
FIELD Date2:=Date2;
@If(Date1="";0;Date2="";0;
Main Topics
Browse All TopicsHi, Experts!
I have two fields that include date, i like to get the days between this two date fields. Any help would be appreciated?
Thanks a lot.
Palli
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here is the working version similar to the website one,
sDate:=[1/1/2001 00:00:00];
eDate:=[2/25/2002 14:35:37];
Begin := sDate;
End := eDate;
@if( End < Big; @Return(0); "");
diff := (End - Begin);
Secs := @Modulo(diff; 60);
Mins := @Modulo(@Integer(diff/60);
Hrs := @Modulo(@Integer(diff/60/6
Days := @Integer(diff/60/60/24);
@Text(Days) + " Days, " + @Text(Hrs) + " Hours, " + @Text(Mins) + " Mins, " + @Text(Secs) + " Secs "
Let me know if it has any flaws, rushing for a meeting catch u later.
~Hemanth
only to claryfy:
the numbert of days is returned by the @If statement in my upper formula.
The two FIELD definitions are not absolutely necessary but good habit. Of corse you have to change field name for Date1 to the greater of the two field names. The name for the older (lower) date should be placed wherever Date2 is used.
1st: convert both dates to text and put them between square brackets.
2nd: concatenate the results, using " - " to join them
3rd: convert it back to date (=date range)
4th: explode it.
Sample:
I've used two datefields: Date1 and Date2
I collect the result in a computed, multivalue date field (you pick a name...), containing following formula:
D1:="[" + @Text(Date1) + "]";
D2:="[" + @Text(Date2) + "]";
@Explode(@TextToTime(D1+ " - " + D2))
It's got no validation yet to see if both date fields contains a valid value and if Date2 > Date1. You'll probably be able to figure that out after you got this running....
If you want to exclude both entyered dates from the list, either use @Adjust before you convert the dates to text, or filter the exploded result, using @Subset.
Good luck!
if you extend the formula like this, then it delivers always the correct difference of days into Days field, either Date1 or Date2 is the greater date. Put it in Postrecalc event definition of the Form:
FIELD Date1:=Date1;
FIELD Date2:=Date2;
FIELD Days:=Days;
@SetField("Days";@If(Date1
Palli,
There is a typo in my code, correct Big to Begin
Here is the corrected code which is similar to the Web sample,
Begin := sDate;
End := eDate;
diff := @if( End < Begin; Begin-End; End-Begin);
Secs := @Modulo(diff; 60);
Mins := @Modulo(@Integer(diff/60);
Hrs := @Modulo(@Integer(diff/60/6
Days := @Integer(diff/60/60/24);
@Text(Days) + " Days, " + @Text(Hrs) + " Hours, " + @Text(Mins) + " Mins, " + @Text(Secs) + " Secs "
Is there any thing more that you are looking for ?
If you can give more details then we can proceed further.
Administration is contacting palli today about open questions dating back to the year 2000, and refusal to update others when follow up requests such as the following have been issued.
palli - Repeated follow ups sent, ignored, some are year 2000
Question(s) below appears to have been abandoned. Your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question. Again, please comment to advise the other participants why you wish to do this.
For special handling needs, please post a zero point question in the link below and include the question QID/link(s) that it regards.
http://www.experts-exchang
Please click the Help Desk link on the left for Member Guidelines, Member Agreement and the Question/Answer process. http://www.experts-exchang
Please click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues, to track all your open and locked questions at this site. If you are an EE Pro user, use the Power Search option to find them.
To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
http://www.experts-exchang
PLEASE DO NOT AWARD THE POINTS TO ME.
------------> EXPERTS: Please leave any comments regarding your closing recommendations if this item remains inactive another seven (7) days.
Thank you everyone.
Moondancer
Moderator @ Experts Exchange
P.S. For any year 2000 questions, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
Business Accounts
Answer for Membership
by: palliPosted on 2002-02-25 at 03:02:57ID: 6824171
Calculate duration between two dates
/date/dura tion.html
http://www.timeanddate.com