Expand my Community achievements bar.

Don't miss the Workfront Community Lens, June Edition!

Date Format Text Mode for Calculated Field or Report Column

Avatar

Level 3

I am creating an internal reference number using the CONCAT function and the date forms part of this. I need to convert a Custom Date field into an all numerical format of YYYY/MM/DD. If this is possible in a Calculated Field in a Custom Form this would great for any help!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

6 Replies

Avatar

Community Advisor

To format a date field into a calculated field in this way, you would have to build this yourself, "from scratch".

 

I recommend you start this by going through the calculated data expressions page.

https://experienceleague.adobe.com/en/docs/workfront/using/reporting/reports/calculated-custom-data/...

 

In particular, look up functions like "year", "month" and "dayofmonth". For the final restriction, look at the "case" function. Feel free to share your work back to this group as I know folks are always interested in looking at each other's solution.

 

edited to add: I ran this through copilot, and it suggests "if the length of your month or day = 1, add a zero" as an alternative to "case", so -- your call.

Avatar

Level 3

I have got a calculated field to manipulate a date. The Months and Days that pull are single digit for example May appears as '5' or the first of the month appears as '1'.

I would like these single digit dates to appear as two digit so 1st May would appear as 01/05.

This is the expression - can it be two digit?:

CONCAT(YEAR({DE:UKI - Campaign Start Date}), "/",MONTH({DE:UKI - Campaign Start Date}), "/", DAYOFMONTH({DE:UKI - Campaign Start Date}))
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

Avatar

Level 4

You just have to remove the first part of the calculation that pulls the Year and switch the placement of the Month and Day. 

It'd be something like this:
CONCAT(DAYOFMONTH({DE:UKI - Campaign Start Date}),"/",MONTH({DE:UKI - Campaign Start Date}))

Avatar

Level 4

Ohh I think I see what you're asking for.  My calc above will give you   1/5 but not 01/05. 

You''d have to insert logic in the expression to evaluate the month and date.  If the month is less than 10 then you'd have an expression that concats "0" in front of month.  Same thing for Day of the Month. 

Avatar

Level 3

Hi Justin - any idea on the calculation for this?

 

Avatar

Community Advisor

moving this one back under your original post. Try using CASE or IF(LEN).