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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Dates

Status
Not open for further replies.

kela97

IS-IT--Management
Jul 28, 2003
7
US
I need to find the difference between two dates assuming there are 360 days in a year and 30 days per month.

This is similar to the DAYS360 function in Excel. Does anyone know if Crystal has a similar function.

For example the the number of days between 1/1/94 and 1/1/95 would be 360. Between 2/1/94 and 1/1/95 would be 330. Between 1/30/94 and 1/1/95 would be 331.

Does Crystal provide any additional financial formulas that are similar to Excel?

I need almost all the functions available in Excel.

Any ideas where to get these funcations?
 
Don't you mean 365, rather than 360?

The function you're looking for is DateAdd. (Syntax: DateAdd('d',{date1},{date2})). Additional information is available in your Crystal Reports online help.

You can get a full list of Crystal functions in the Formula Editor window within Crystal Reports.

Naith
 
Sorry, I meant DateDiff - not DateAdd. The syntax remains the same.
 
Naith,

Thanks for your reply. But I do mean 360 days in a year. This kind of year is used to calculate arruced interest and amortization amount in Govt. Bonds. Excel has a whole array of functions for 360 days calculations. Eg. DAYS360

This kind of year is used only in finance.

Do you think there is something like this in Crystal? Is there an Addin for Crystal for advanced financial calculations.

Regards,
Gaurab
 
Kela,

I believe the only financial functions which allow you to set the number of days in a year are FRInventoryTurnover and FRAccRecTurnover. Both are explained in your help file.

Excel and Crystal do not have entirely synonymous functions, but you should be able to write Crystal formulae(s) to achieve what you want.

e.g. Create an array, populated with the 5 dates you want excluded from the year. Apply a condition to subtract a day for each date in the array that features in the DateDiff period.

Naith
 
try the following formula :

DateVar FromDate := date(1994,01,01);
DateVar ToDate := date(1994,01,30);

datediff("m",FromDate,ToDate)*30
+
datediff("d",date(2000,01,day(fromDate)),date(2000,01,day(todate)))

Replace the bold items with your field names.
I haven't tested every possible input, but it seems to work on your examples. If nothing, else it gives you a start point.........

Reebo
Scotland (Sunny with a Smile)
 
Reebo99,

That was awesome. Thanks a lot for your help. You just made my day. Sincere thanks from my side. You are awesome.

Naith,
Thanks for your suggestion. Thanks for your time.

I really appreciate all your time and help. You guys rock.

Cheers,
Gaurab
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top