How to Format a DateTime to a Specific Format?
Comments
-
Could you tell me how I can convert the DateTime data to a String like below:
[b]1/20/2022[/b] to [b]January 20, 2022[/b]
I tried the "Get Long Date String" step, but that shows Thursday, January 20, 2022. I would like it to show without the day of the week.
-
Hello!
This is something we can build with the Merge Plain Text editor. In my example, our DateTime data will be coming from the Get Current Date step, but this can be applied to any situation where we want to convert dates. Following this, I will be mapping it into a Create Data step so that we can see the difference between the standard and formatted data. Below is my current flow configuration:
[img]https://lh3.googleusercontent.com/KVfr60hXGl6HMP2sPTdVfiZd_yAjjByc0DmFtDvmpKmWqR0RsMFAADYI4zKlAP9xYJ_hUcXydcUmFBc9GqFqAPCOFU6Frc7ajopfJ-solGjkn0kLKxqdv-qEQjGd64muZF8_9SUL[/img]
I have two inputs to our Create Data step, Sample Data Time is an unformatted String output, and Formatted Date Time is our formatted data.[img]https://lh5.googleusercontent.com/Wivrn4qigc7ThZdQS56hSKh0CEFFuBhy1-h6I6Y8_h7kjeW_FjOMfTQOBmlZAz5XjvqRs6Vyk8ZaqBVGVWe7yJDvya-wYTN9CT7z1I36MFPA8hXxJpyA82sukRQ2DOhpHceJLtpK[/img]
As you can see above in the Mapping Editor, our Sample Date Time is taking a direct input from the Get Current Date output. The Formatted Date Time is using the Merge Plain Text option. When this is selected, a window will open, and will allow you to build your own string using the available data in the flow.Since the DateTime datatype has formatting available to it by default, we are able to use these to piece together the exact data we want.
Hope this helps!
-Ethan
Howdy, Stranger!
Categories
- 2.1K All Categories
- 18 General
- 155 Installation / Setup
- 991 Flows
- 86 Rules
- 203 Administration
- 204 Portal
- 433 General Q & A
- 600 Forms
- 282 Reports
- 3 Designer Extensions
- 38 Example Flows
- 32 CSS Examples
- 1 Diagram Tile
- 5 Javascript Controls
- 139 Pages
- 1 Process Mining
- New Features
- 150 Datastructures
- 50 Repository
- 169 Integrations
- 25 Multi-Tenant
- 21 SDK
- 40 Modules
- 38 Settings
- 20 Active Directory
- 12 Version 7
- 34 Version 8