How to change the date/time format

Is there a way to make a date/time field look pretty? I’m looking to be able to format the date showing as MM/DD/YYYY HH:MM instead of the UTC format that it defaults to.

This isn’t a way to do it from within the Softr platform yet. You’ll need to create a new field in your Airtable and use the DATETIME_FORMAT function.

Documentation is here:
Supported format specifiers for DATETIME_FORMAT – Airtable Support

The use the new field in your Softr app.

Let me know if you need further help.

2 Likes

That was the one, thanks.

I’m still having trouble.

Here’s my formula: DATETIME_FORMAT({Time Complete},‘M/D/YYYY, hh:mm’)

Here’s the results, but the times don’t match. I don’t get it.

image

I would suggest using HH instead of hh also please check if you have a timezone in the first one if yet then you might need to add it to the formatting too

I found that when the actual date field has “Use the same time zone (GMT) for all collaborators” turned off (which means local timezone), and using SET_TIMEZONE() to my local time zone, the dates and times match. More info here: https://support.airtable.com/hc/en-us/articles/360058239594

Example: DATETIME_FORMAT(SET_TIMEZONE({Updated On},‘America/Phoenix’),‘LLLL’)
produces this: Thursday, October 21, 2021 7:59 AM in my time zone.

1 Like

I played with that a bit this morning and did that very thing. I think the magic is in the SET_TIMEZONE.

Thanks for the follow-up answer.

1 Like

Hi, I’m having trouble with the date time format - wonder if you (or anyone…) can help please?
In Airtable I have a formula to create a sentence to be displayed in Softr.

Formula: "THIS AGREEMENT, dated “&DATETIME_FORMAT(NOW(),‘MMM D, YYYY’)&”

This is giving the correct result in the Airtable field.
Screen Shot 2022-12-10 at 2.23.36 PM

However when it is rendered by Softr, it changes it to:

THIS AGREEMENT, dated 2022-12-01T17:04:50.000Z,

Any idea why this is not working? Would appreciate any tips on how to resolve this. Thanks!

I tried what you are doing, and didn’t see the problem you’re seeing.

I suspect there’s a config problem somewhere. For example, maybe the list or list details block is pointing at a different Airtable field from what you meant?

A couple of other thoughts while I’m at it:

  • you probably want some kind of timezone handling in that formula, maybe something more like:
DATETIME_FORMAT(
  SET_TIMEZONE(
    NOW(), 'America/Los_Angeles'),
  'M/D/Y h:mm A'
)
  • using NOW() in that Airtable formula might not be what you want, because it means every time that formula is recalculated, the date will change

Hi @dcoletta thanks for your reply. You’re right! It was referring to a different field where I had first added the formula. That has fixed the formatting issue now.

I’m using now() because this displays the current date to the user when they view the agreement.

Once they accept it and submit the form, it stores their consent and the date of submission. Ideally I would like to set some logic to detemine the block visibility so I can add a duplicate block that displays the submission date once that exists.

Failing this, I will duplicate the whole page and just replace that block to point at the airtable field that contains the date of the submission.