Converting a date to a readable format in a script

Hi,

I am reading a date from a field and want to include it in an email (as part of an automation).

How do I go about converting the date that looks like this “2021-02-10t11:30:00.000z” into something like this - 10/02/2021 11:30am (or similar)?

Thanks!

This is more of a JavaScript question than an Airtable question.

You can convert a JavaScript date object to a string using any of the to...String() methods available for date objects. They are documented here. You probably want toLocaleString(). You can specify options to get the exact formatting that you want.

This was helpful thanks! I didnt realise that those options were not available to me because I was trying to use them on a string :slight_smile:
Thanks!

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.