Thursday, December 7, 2023

Power Automate Desktop Date Conversion

Put together a little Date Conversion template for Power Automate Desktop that I need to save out.  Copy/paste the quote block areas and you are on your way.


Date Conversions

DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''MM/dd/yyyy''' Result=> CDT_Formatted

DateTime.Add DateTime: CurrentDateTime TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> CDTminus1

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CDTminus1 CustomFormat: $'''MM/dd/yyyy''' Result=> CDTminus1_Formatted

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''MM/01/yyyy''' Result=> FirstDayCurrentMonth

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''01/01/yyyy''' Result=> FirstDayCurrentYear

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''12/31/yyyy''' Result=> LastDayCurrentYear

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''MM''' Result=> ThisMonth_MM

Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''yyyy''' Result=> ThisYear_yyyy

# End Day Last Month = First Day This Month - 1 day

DateTime.Add DateTime: FirstDayCurrentMonth TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Days ResultedDate=> EndDayLastMonth

# First Day Last Month = First Day This Month - 1 month

DateTime.Add DateTime: FirstDayCurrentMonth TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Months ResultedDate=> FirstDayLastMonth

No comments:

Post a Comment


Popular Variations