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!

Date Formula

Status
Not open for further replies.

Jewel142

ISP
Jun 17, 2009
39
I am trying to calculate a date in Crystal. What need to do is calculate number of days previously worked and minus from their rehire date calculate a combined length of service date.

My calculation is working properly but I can't get the date to calculate correctly.

Here is my formula.

{EMPLOYEE_1.New_Rehire_date} - {@Calc_Days}

What am I doing wrong?

Thanks!

Jewel
 
I even tried using the DateAdd function:

DateAdd("d",-{@Calc_Days},{EMPLOYEE_1.New_Rehire_date})

but it still doesn't won't work. Thanks!
 
What is the output you are receiving?

also, is {EMPLOYEE_1.New.Rehire_Date} a date field or a datetimefield? if it is a datetime field you may need to use:

Datevalue({EMPLOYEE_1.New.Rehire_Date})-{@Calc_Days}

-jcrawford-

Not in word only, but in deed also... 1Jn3:18
 
The {EMPLOYEE_1.New.Rehire_Date} is a date field.

I validated my formula in Excel for example:

Rehire Date 7/19/2011 - Days previously Worked of 320

should give me a returned date of 9/2/2010

instead I am getting a date of 02/19/2011 which isn't even close
 
What is the formula you are using for {@Calc_Days}?

-jcrawford-

Not in word only, but in deed also... 1Jn3:18
 
Okay - I think I figured out what was wrong. The calculated days should be a SUM and I believe it's only pulling the last field in the report in.

That being said. I fixed my formula so that I am now calculating correctly.

datevalue({EMPLOYEE_1.New_Rehire_date})-sum({@Calc_Days})

WooHoo!!! Thank you for your help!! After looking at things for so long sometimes it just takes a question or two for the light bulb to go on :)

Jewel~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top