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

Adding hours or minutes from formula to a DateTime field

Status
Not open for further replies.

veles

Technical User
Sep 1, 2006
57
CA
Hi.

I am using crystal XI and need some help.

I have a DateTime field that I am trying to add hours (or minutes) comming from a variable from a sub report.

The hours are calculated in a sub report and passed to the main report. In the main report I have the variable {VAR} as a number.

I need a formula that will add the hours from the number variable to the DateTime field.

I tried
dateadd('n', +20,{DateTime})

This works adding the 20 min to the DateTime field, but if I replace the +20 with +{VAR} it doesn't work.

Any help is appreciated.

Thanks
 
It looks like the formula worked if I put it at the same level as the variable.
I am still looking into it
 
The formula should be in a section below the one containing the sub. So if the sub is in GH1a, you could reference the variable in a formula in GH1b, like this:

whileprintingrecords;
shared numbervar mins;
dateadd("n",mins,{table.datetime})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top