Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Eliminate time stamp from results of a formula

Topic Labels: Formulas
Solved
Jump to Solution
1041 4
cancel
Showing results for 
Search instead for 
Did you mean: 
sstillman
5 - Automation Enthusiast
5 - Automation Enthusiast

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

2 Solutions

Accepted Solutions

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'
)

Screenshot 2024-07-16 at 10.53.16 AM.png

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?

See Solution in Thread

sstillman
5 - Automation Enthusiast
5 - Automation Enthusiast

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

See Solution in Thread

4 Replies 4
FarioConsulting
6 - Interface Innovator
6 - Interface Innovator

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?

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'
)

Screenshot 2024-07-16 at 10.53.16 AM.png

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?

sstillman
5 - Automation Enthusiast
5 - Automation Enthusiast

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