hi, i want to format my datetime field as this example:
"Th May 25 2023, 10:00:00 America/New_York"
i've tried with v symbol from unicode.org examples (VV America/Los_Angeles The long time zone ID.) but no luck
hi, i want to format my datetime field as this example:
"Th May 25 2023, 10:00:00 America/New_York"
i've tried with v symbol from unicode.org examples (VV America/Los_Angeles The long time zone ID.) but no luck
Hey @kheptan! As Scott suggested, Moment should be useful here Moment is a library included in Retool that helps with all things dates (formatting, parsing, etc.)
If you're passing in a date string that looks like "2023-05-25T10:00:00Z", for example, then this should get you the format you're looking for:
moment(dateString).format("ddd MMM D YYYY, HH:mm:ss [America/New_York]");
In this example, the dateString
represents the input date string in ISO 8601 format.
The format string "ddd MMM D YYYY, HH:mm:ss [America/New_York]" is composed of the following components:
ddd
: Three-letter abbreviation of the day of the week (e.g., "Thu").MMM
: Three-letter abbreviation of the month (e.g., "May").D
: Day of the month (e.g., "25").YYYY
: Four-digit year (e.g., "2023").HH
: Two-digit hour in 24-hour format (e.g., "10").mm
: Two-digit minute (e.g., "00").ss
: Two-digit second (e.g., "00").[America/New_York]
: Timezone identifier for New York.You can adjust the format string as per your requirements or modify it to match the format of your original date string!