I use this mostly to format notification emails.
Using formatDateTime() provides a value based in the UTC timezone. Therefor, I start with convertFromUtc().
Code #
These are the most common patterns I use.
Example 1 - short date #
convertFromUtc(<Date Value>,'Eastern Standard Time','d')
Output: 9/25/2023
Example 2 - short time #
convertFromUtc(<Date Value>,'Eastern Standard Time','g')
Output: 9/25/2023 2:20 PM
US timezones #
- Eastern Standard Time
- Central Standard Time
- Mountain Standard Time
- Pacific Standard Time