This will be a quick post, but thought someone out there might find it useful if they are working in Microsoft Flow and need to get a local date and time and/or format a date and time.

This evening I was building a Flow. In this case it is a Flow that sends an email and I wanted to include the current date in the subject of the email (i.e., “Here are your work items for 01/21/2018”.) The expression design in Flow still seems odd to me – being that I primarily write C# code and a good bit of JavaScript.

So after a few minutes of digging I figured out the expression:

formatDateTime(convertFromUtc(utcNow(),'Eastern Standard Time'), 'd')

Be sure to replace ‘Eastern Standard Time’ with the correct time zone name. You can get a list from this Microsoft support site. Be sure to use the value in the Name of Time Zone column. Also, if you are using a time zone with periods “.” in it you may or may not need to remove them, you’ll have to experiment. You can also get a list of time zone names on your computer (so they should work on Flow, but not guaranteed) with this line of code in LINQPad:

TimeZoneInfo.GetSystemTimeZones().Dump();

You can find the options for the time zone format here in the .NET documentation.

And keep having fun with Microsoft Flow…it’s a great platform that is constantly growing with new Connectors and Actions!