DateTime fields from Dataverse / Common Data Service (Current Environment) are retrieved in full Date and Time format. And in common applications, you are required to only retrieve the Date and not the Time. Or even Format the Date Time in a certain way.
Let’s look at how to format DateTime in a Flow which appears as below
Let’s look at a simple example by trying to format a Created On date field.
- Let’s a take a variable of type String to store our formatted Date. Now, in the variable, go for Functions and look for FormatDateTime function.
- Now, it asks for 2 parameters – TimeStamp and Format.
- Since I’m picking the field from the trigger itself, I’ll use the below formula to pick from triggerBody().
In case you want to also learn how to use triggerBody(), triggerOutputs() or outputs(), you can refer below posts –
- In the second parameter, put the format of the date in single quotations as shown below –
You can follow this official Microsoft documentation – https://docs.microsoft.com/en-gb/dotnet/standard/base-types/custom-date-and-time-format-strings?WT.mc_id=DX-MVP-5003911
- And your Date Format is set. When you run the Flow, you’ll get the formatted date.
Hope this was quick and helpful!
Here are some more Power Automate / Flow posts you might like to check –
- Formatting Approvals’ Details in Cloud Flows | Power Automate
- Number Formatting in a Flow | Power Automate
- Parallel Branching in Cloud Flows – Isolate Response dependent Step Actions in parallel branches | Quick Tip
- Trigger Conditions not working in a Cloud Flow? Here’s Why | Power Automate Quick Tip
- InvalidWorkflowTriggerName or InvalidWorkflowRunActionName error in saving Cloud Flows | Power Automate Quick Tip
- Read OptionSet Labels from CDS/Dataverse Triggers or Action Steps in a Flow | Power Automate
- Run As context in CDS (Current Environment) Flow Trigger | Power Automate
- Setting Lookup in a Flow CDS Connector: Classic vs. Current Environment connector | Power Automate Quick Tip
- Make On-Demand Flow to show up in Dynamics 365 | Power Automate
- Task Completion reminder using Flow Bot in Microsoft Teams | Power Automate