![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I created a database for the office to track the details of the employees, including start/hire dates. The HR Department wants to project the anniversary dates of the employees and I did it using the following calculation If(DateofHire + 1915 <= Today,"Ten Year Anniversary: " & (DateToText(DateofHire + 3650)),If(DateofHire + 1185 <= Today,"Five Year Anniversary: "&(DateToText(DateofHire + 1825)),If(DateofHire + 450 = Today,"Three Year Anniversary: " & (DateToText(DateofHire + 1095)),If(DateofHire + 90 <= Today,"One Year Anniversary: " & (DateToText(DateofHire + 365)), "Probationary")))) The anniversary dates are as follows 1 YR 3 YR 5 YR 10 YR In order to display the projected anniversary date I had to add 365 days to the hire date or a multiple of 365 for the other years. The challenge comes from the fact the there are not 365 days in every year and an anniversary date should fall on the same date - 12/09/2000 to 12/09/2005. adding 365 days is inconsistent and changes the date. Finally, my question - how do I change only the year and not the date? |
#3
| |||
| |||
|
|
Year3 = Date( Month(DateofHire), Day(DateofHire), Year(DateofHire) + 1) Year3 = Date( Month(DateofHire), Day(DateofHire), Year(DateofHire) + 3) |
#4
| |||
| |||
|
|
I created a database for the office to track the details of the employees, including start/hire dates. The HR Department wants to project the anniversary dates of the employees and I did it using the following calculation If(DateofHire + 1915 <= Today,"Ten Year Anniversary: " & (DateToText(DateofHire + 3650)),If(DateofHire + 1185 <= Today,"Five Year Anniversary: "&(DateToText(DateofHire + 1825)),If(DateofHire + 450 = Today,"Three Year Anniversary: " & (DateToText(DateofHire + 1095)),If(DateofHire + 90 <= Today,"One Year Anniversary: " & (DateToText(DateofHire + 365)), "Probationary")))) The anniversary dates are as follows 1 YR 3 YR 5 YR 10 YR In order to display the projected anniversary date I had to add 365 days to the hire date or a multiple of 365 for the other years. The challenge comes from the fact the there are not 365 days in every year and an anniversary date should fall on the same date - 12/09/2000 to 12/09/2005. adding 365 days is inconsistent and changes the date. Finally, my question - how do I change only the year and not the date? |
#5
| |||
| |||
|
|
You can split the DateOfHire into day, month and year (as numbers) and re-use them. cDay = day ( DateOfHire ) cMonth = month ( DateOfHire ) cYear = year ( DateOfHire ) Then add 1 (or whatever you need) to the year and put them back together as date cAnniversary = Date ( cMonth ; cDay ; cYear+1 ) If ( today = cAnniversary ; "HURRAY!" ; "Just wait...") with FM7 use Get ( CurrentDate) instead of Today |
#6
| |||
| |||
|
#7
| |||
| |||
|
#8
| |||
| |||
|
#9
| |||
| |||
|
#10
| |||
| |||
|
|
Just to be clear - this will result in separate fields for each anniversary date, plus one which will calculate the one that is coming up? Admittedly, I want to do everything that I possibly can with one field, but a couple extra won't really hurt me that much ; ) |
![]() |
| Thread Tools | |
| Display Modes | |
| |