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!

Subtract dates, and seeing the result in years (ie yy.yy

Status
Not open for further replies.

CEG

Technical User
Feb 13, 2002
22
0
0
GB
I have to provide a report showing length of service of employees over the last two years.

I have used the following:

if{EMP_RECORD.E_DATE_LEFT}<DateValue (1967,12,31)
then datediff
(&quot;y&quot;,CurrentDate,{EMP_RECORD.E_DATE_JOINED})
else
{EMP_RECORD.E_DATE_LEFT}-{EMP_RECORD.E_DATE_JOINED}

This works but shows the result in number format.

ie (To-day 30/07/2002)-(Startdate 25/03/1996) = 2318.

How can I get it to display in yy.yy format The above should read 6.06 years.

Appreciate some advice on this.


 
Can't you just divide the result by 365 .

For your example that yields 6.35 which looks about right as the difference is 6 yrs, 4 months and 5 days. Can't see how you arrive at 6.06.

Ian
 
Charge your else statement to:

Datediff(&quot;y&quot;,EMP_RECORD.E_DATE_LEFT},EMP_RECORD.E_DATE_JOINED}) Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Charge your else statement to:

Datediff(&quot;y&quot;,{EMP_RECORD.E_DATE_LEFT},EMP_RECORD.E_DATE_JOINED}) Software Training and Support for Macola, Crystal Reports and Goldmine
714-348-0964
dgilsdorf@mchsi.com
 
Many thanks.

Why I could not see it is a mystery.

Thanking you once again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top