Forum Discussion
NicholasBowman
8 years agoNew Member
Date Formula
Currently trying to convert a person's birth date to the same month and day in the current year. I have used the date formula as such: Birth Date This Year = DATE(YEAR(today()),MONTH(contacts[Birth D...
v-jiascu-msft
8 years agoMicrosoft Employee
Hi NicholasBowman,
I guess there could be a date like 2004/2/29 while we don't have 2/29 in the current year. Please try the formula below.
Column 2 =
VAR yearNow =
YEAR ( TODAY () )
VAR isLeapNow =
IF (
MOD ( yearNow, 4 ) = 0
&& MOD ( yearNow, 100 ) <> 0,
1,
IF ( MOD ( yearNow, 400 ) = 0, 1, 0 )
)
RETURN
IF (
FORMAT ( [Date], "MMDD" ) = "0229"
&& isLeapNow <> 1,
DATE ( 2100, 1, 1 ), //change this part to what you like
DATE ( yearNow, MONTH ( [Date] ), DAY ( [Date] ) )
)
Best Regards,
Dale
NicholasBowman
8 years agoNew Member
Thanks, i did try this but ended up with the same error response. Tried to test it another way by using an if function to return a different result if the DAY(date) = 29, but that also resulted in the same error
- v-jiascu-msft8 years agoMicrosoft Employee