web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to Use date Expres...
Power Automate
Unanswered

How to Use date Expressions in PAD

(0) ShareShare
ReportReport
Posted on by 22

Hey All, 

 

Just had a query regarding using Date Expressions in Power Automate Desktop. I have a step within my flow which gets my Current Date and Time. I want to go one month back and return the date that is the first day of that particular month and return date that is the last date of the month.

 

I would be able to use expression on Cloud Flow simply by using startdate and enddate formula. However, I am not being able to recreate this in PAD. Was wondering if anyone could help?

 

Date time.png

Categories:
I have the same question (0)
  • Verified answer
    VJR Profile Picture
    7,635 on at

    Hi @Imrans23 

     

    No direct functions available in PAD but you can copy-paste the below code in PAD to get the desired results using vbscript.

     

    DateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateOnly CurrentDateTime=> CurrentDateTime
    DateTime.Add DateTime: CurrentDateTime TimeToAdd: -1 TimeUnit: DateTime.TimeUnit.Months ResultedDate=> ResultedDate
    System.RunVBScript VBScriptCode: $'''varLastdate = DateSerial (%CurrentDateTime.Year%, %CurrentDateTime.Month%, 0)
    WScript.Echo varLastdate
    ''' ScriptOutput=> LastDay ScriptError=> ScriptError
    System.RunVBScript VBScriptCode: $'''varFirstDate = DateSerial (%ResultedDate.Year%, %ResultedDate.Month%, 1)
    WScript.Echo varFirstDate
    
    ''' ScriptOutput=> FirstDay ScriptError=> ScriptError
    Display.ShowMessage Message: $'''The first date of previous month is: %FirstDay%
    The last date of previous month is: %LastDay%''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed

     

     

     

    VJR_0-1640241554133.png

     

     

    PS: You will get more help on Power Automate Desktop in its dedicated page here.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard