Formatting a Calculated Date

I want to display tomorrow’s date in a particular format, but my formula appears to be invalid.

Is this something that can be done?

Alternatively, is there a way to finagle a date picker?

(I’m going on vacation this week, but I look forward to picking this up again when I’m back!)

NOW() returns a string.

Add_Duration also returns a string.

Format_Datetime_Local converts a date-time format into your new chosen format and returns a string.

So you need to convert the string back into a date before adjusting the format:

That worked for me.

2 Likes

Yes, what Jeff posted works – that said, we should fix NOW and ADD_DURATION to return datetime as that’s what they do return; it’s a bug that their return type is unformatted string.

Note that schema mismatch errors are informational – the app runtime will attempt to evaluate the formula with whatever is in there, an in this case the formula would succeed even without the DATETIME wrapper, as the string itself IS of a compatible format.

1 Like

Thanks Jeff! I was banging my head on the wall trying to figure out the correct format string, turns out the format string in the docs works BUT this tip of going back to a string worked for me as well (I didn’t need the additional ADD_DURATION function). Docs need to have more info and better examples! Seems to be a bug to me, but I’m not sure of the intent, so PLEASE DOCUMENT THIS. I’m getting timestamps back from the backend that I need to convert, I’m sure I’m not alone. DATETIME - Composer