Skip to main content
Solved

Eliminate time stamp from results of a formula

  • July 15, 2024
  • 4 replies
  • 55 views

Forum|alt.badge.img+2

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

Best answer by TheTimeSavingCo

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?

4 replies

Forum|alt.badge.img+6
  • Participating Frequently
  • July 15, 2024

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


Forum|alt.badge.img+2
  • Author
  • New Participant
  • July 15, 2024

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?


TheTimeSavingCo
Forum|alt.badge.img+31

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?


Forum|alt.badge.img+2
  • Author
  • New Participant
  • July 16, 2024

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!