Manage date format in MS Flow

While working with MS Flows, we are getting dates in UTC format and most of the time we need to convert it to our local time zone. So, here are some most common date formats which most of the people required.

Click here to get the Microsoft Time Zone IDs

https://docs.microsoft.com/en-us/previous-versions/windows/embedded/gg154758(v=winembedded.80)

In this example, I am using ‘Arabian Standard Time’ to get them for our local time zone. Additionally, we will use only two functions to get the required date one is “convertFromUtc()” and utcNow() functions.

 

In simple language  “convertFromUtc()” function can help you to convert the dates in your local time zone. It requires three properties and utcNow() function can provide the DateTime stamp on the instance.

In my scenario I have initialized a variable (my variable name is dtNow), Variable type is “String” then undervalues select the expression and enter any of the expression as your need.

 

 

For example, Today’s timestamp 10 August 2019 15:02:56, so these are the sample of expression and output.

Date time format

Expression

Output

d

convertFromUtc(utcNow(),’Arabian Standard Time’,’d’)

8/4/2019

dd-MM-yy

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd-MM-yy’)

04-08-19

dd/MM/yy

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd/MM/yy’)

04/08/19

MMddyyyyHHmmss

convertFromUtc(utcNow(),’Arabian Standard Time’,’MMddyyyyHHmmss’)

08042019150256

yyyy-MM-dd-HH:mm:ss

convertFromUtc(utcNow(),’Arabian Standard Time’,’yyyy-MM-dd-HH:mm:ss’)

2019-08-04-15:02:56

yyyy/MM/dd-HH:mm:ss

convertFromUtc(utcNow(),’Arabian Standard Time’,’yyyy/MM/dd-HH:mm:ss’)

2019/08/04-15:02:56

dd/MM/yyyy-HH:mm:ss

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd/MM/yyyy-HH:mm:ss’)

04/08/2019-15:02:56

dd-MM-yyyy

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd-MM-yyyy’)

04-08-2019

dd-MMM-yyyy

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd-MMM-yyyy’)

04-Aug-2019

dd/MMM/yyyy

convertFromUtc(utcNow(),’Arabian Standard Time’,’dd/MMM/yyyy’)

04/Aug/2019