Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Difference in mm/dd/yyyy hh:mm Formet

Status
Not open for further replies.

Test12

Programmer
Oct 5, 2000
1
US
Hi Everyone:

Could anybody help me in finding out the date difference in mm/dd/yyyy hh:mm format. I have a date field and has to calculate the difference using system date. Please suggest me if anybody has idea on how to achieve that.

Thanks
Vicky [sig][/sig]
 
I don't think there is a difference function for date, you will probably have to do this manually. Though I don't have the specifics for you, the general approach would be to:
convert each to just date format
extract the year, month and day for each date and store in different variable
subtract system year from year, system month from month, etc.
if the month or day of db is greater than system month or day, "carry" from the year or the month.
store the differences in variables as well
apply logic to figure out date.

or easier might be to convert the difference to days. and then convert it back into date.

p.s. don't forget to post a FAQ when you are finished :) [sig][/sig]
 
You also might want to look at the FAQ section link to calculate business days between dates, that may be helpful. [sig][/sig]
 
Yes, There is a DateDiff function. If you are using Crystal Reports 7 or greater
the function will be found as a download on the SeagateSoftware Web Site.
It will be a UFL file. You can use the function to calculate
the date difference ot two datetime fields.

Let me know if you need more information!
[sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top