Print Page | Close Window

DateDiff

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=19896
Printed Date: 05 May 2024 at 1:28am


Topic: DateDiff
Posted By: VickiM
Subject: DateDiff
Date Posted: 16 Aug 2013 at 2:18am
Hi.
 
I know this is probably really simple but I have no idea how to do.  How do I write a formula to find the datediff of someone's hire date and their term date in Access?
 
If you can help me, I'd certainly appreciate it.
 
Here is what I've figured out so far:  Yrs: DateDiff("yyyy",[LAWSON_EMPLOYEE]![DATE_HIRED],[LAWSON_EMPLOYEE]![TERM_DATE]) and it works sort of.  Right now it pulls the number of years based soley on the year so if someone started 7/1/2012 and left 5/1/2013, it shows 1 year.  I need it to show as a 0 since they were not here for an entire year.
 
Thanks!


-------------
VickiM



Replies:
Posted By: kevlray
Date Posted: 16 Aug 2013 at 5:26am
Do it by months, and determine on how many years (example  int(DateDiff("m",[LAWSON_EMPLOYEE]![DATE_HIRED],[LAWSON_EMPLOYEE]![TERM_DATE])/12)


Posted By: VickiM
Date Posted: 16 Aug 2013 at 6:42am
That worked beautifully!  Thank you so much!

-------------
VickiM



Print Page | Close Window