Hello,
I have a Formula field called Birthday this Year which just takes the value of the standard birthdate field and changes the year to this year:
DATE( YEAR( DATEVALUE( NOW() ) ) , MONTH( Birthdate ) , DAY( Birthdate ) )
I have a custom text field that I'm attempting to swap out the standard Birthdate field with in this formula above, but I can't get any output. I'm not sure if it's because the custom field is actually a text field, but there are properly formatted date values in that text field. Here's my formula:
DATE( YEAR( DATEVALUE( NOW() ) ) , MONTH(DATEVALUE( Account.SL_BWM_Birthdate__c )) , DAY(DATEVALUE(Account.SL_BWM_Birthdate__c )))
Any ideas how I can transform a date in a text field into a date that's able to be pulled in above?
Thanks,
Ashley
Yes — the issue is very likely that Account.SL_BWM_Birthdate__c is a Text field, and DATEVALUE() only reliably converts text when it is in Salesforce's expected date format.
If your text field contains dates like 07/27/1985, try explicitly parsing the text into year/month/day rather than relying on DATEVALUE():
DATE(
YEAR(TODAY()),
VALUE(MID(Account.SL_BWM_Birthdate__c, 1, 2)),
VALUE(MID(Account.SL_BWM_Birthdate__c, 4, 2))
)