Reformatting a non mandatory date field in expression editor
I have a requirement to output date in the format DD/MM/YYYY. However, our Adobe Campaign Standard has a default date format of YYYY/MM/DD.
I do not have system admin access and have no idea if we can change this default format. That would be good to know as a possible solution but for now I need to reformat from YYYY/MM/DD to DD/MM/YYYY. The excellent solutions such as the ones below only work for a field that is populated all the time. I need something different for a date field that is sometimes blank.
Solved: Reformatting date field in expression editor - Adobe Experience League Community - 413026
Solved: Re: Convert System Date to mmddyyyy format - Adobe Experience League Community - 401612
In detail expressions such as:
Iif(Day([your_date_field]) > 9, ToString(Day([your_date_field])), '0' + ToString(Day([your_date_field]))) + '/' + Iif(Month([your_date_field]) > 9, ToString(Month([your_date_field])), '0' + ToString(Month([your_date_field]))) + '/' + ToString(Year([your_date_field]))
return "0/0/" when the optional date field is blank. How do we avoid that and return a blank output for a blank input?
The only thing I get possibly working is wrapping all of that in an Iif and checking if the result is '0/0/' then output '' else output the expression. There must be a more efficient / elegant way? Something using a function to check if a date field is blank?
I have tried trying IsEmptyString function and IS NULL (SQL) but Campaign complains they need a CAST (but adding a ToString does not work).
Many thanks in advance to any suggestions