Skip to main content

Hello - 

I need to calculate a date, in certain circumstances, that is 75 days out from another date in my table. I’m using this formula:

SWITCH({S/N}, 'no', DATEADD(DOB, 75, 'days'), 'NOW',DATEADD(DOB, 75, 'days'),'NA')

which calculates correctly, but includes a time stamp in the results (2024-07-24T00:00:00.000Z). What do I need to do to my formula to get the date only, in mm-dd-yyyy format? My apologies if this is covered somewhere else. I’m not finding exactly what I need in the guides or past posts to this forum.

Thanks,

Susan

Hi Susan,
Using the DATETIME_FORMAT function should get you the date in the "mm-dd-yyyy" format


Hi Susan,
Using the DATETIME_FORMAT function should get you the date in the "mm-dd-yyyy" format


I'm new to Airtable formulas. Can you tell me/show me where/how to add that to my formula?


I'm new to Airtable formulas. Can you tell me/show me where/how to add that to my formula?


Try this:

SWITCH( {S/N}, 'no', DATETIME_FORMAT( DATEADD( DOB, 75, 'days' ), 'MM-DD-YYYY' ), 'NOW', DATETIME_FORMAT( DATEADD( DOB, 75, 'days' ), 'MM-DD-YYYY' ), 'NA' )

I'm curious about the formula you have though; both "no" and "NOW" appear to be adding 75 days to the DOB.  Is that intended?


Try this:

SWITCH( {S/N}, 'no', DATETIME_FORMAT( DATEADD( DOB, 75, 'days' ), 'MM-DD-YYYY' ), 'NOW', DATETIME_FORMAT( DATEADD( DOB, 75, 'days' ), 'MM-DD-YYYY' ), 'NA' )

I'm curious about the formula you have though; both "no" and "NOW" appear to be adding 75 days to the DOB.  Is that intended?


Yes, that's intended. Thank you so much for your help. I wouldn't have gotten that right on my own!