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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to get numeric day...
Power Automate
Unanswered

How to get numeric day of week from date

(0) ShareShare
ReportReport
Posted on by 12

Given a Date or DateTime,  the DayOfWeek property gives a text value eg. Friday, whereas I need the integer value.  Where is that?
What Im trying to do is get the Sunday date for the current week, so I supposed it would be:
CurrentDate - DayOfWeek

help?

I have the same question (0)
  • ScottShearer Profile Picture
    25,290 Most Valuable Professional on at

    @bitshift 

    dayOfWeek() actually does return an integer.  Sunday is 0 and Saturday is 6

    image.pngimage.png

    If you are looking for the previous Sunday, see my example below:

    image.pngimage.png

     

  • bitshift Profile Picture
    12 on at

    Sorry I wasnt clear, this is regarding PAD - power automate desktop
    Datatype properties - Power Automate | Microsoft Docs

     

    Dates

    DATESProperty Description
    YearThe year part of the datetime value.
    MonthThe month part of the datetime value.
    DayThe day part of the datetime value.
    DayOfWeekThe name of the day (Sunday, Monday etch).
    DayOfYearThe day of the year part of the datetime value (1-365/6).
    HourThe hour part of the datetime value.
    MinuteThe minute part of the datetime value.
    Second

    The seconds part of the datetime value.

     

    bitshift_0-1639166343385.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Do you need Power Automate Desktop or Power Automate, like @ScottShearer is using?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I would use a Switch:

     

    Switch %dayofweek%
    Case “Sunday”, %result% = 1

    Case “Monday”, %result% = 2
    and so on

    End (Switch)

  • bitshift Profile Picture
    12 on at

    Why is there a difference between power automate cloud and desktop, or am i missing something?

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    Here is some input from other users:  https://powerusers.microsoft.com/t5/General-Power-Automate/Power-Automate-Cloud-vs-Desktop/td-p/792484

     

    Personally, I think PAD is easier to use, bot the online version has more capability, such as triggers being able to occur from online activity.  Ex. it taps into your outlook and says "when I receive an e-mail from so-and-so, do this."

    In PAD, you would have to trigger the flow manually (or schedule a flow to run systematically), and you could say, "check all unread messages for an e-mail from so-and-so, and do this."

     

    So, PAD is a little limited in that manner.  I think the best is to learn both.  PAD might be better to learn first to take care of your local processes on your own workstation.

  • bitshift Profile Picture
    12 on at

    I was able to accomplish what I needed with a switch.  What a pain!  Would be nice to have the numeric value available from DayOfWeek or something similar

    bitshift_0-1639169789718.pngbitshift_1-1639169830966.png

     

  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    You might find this interesting too; it was for "last Friday", but you could easily change that to "last Sunday", if you always need last Sunday's date.

     

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/Append-Text-to-File-Name-in-Save-As-box/m-p/1356751#M8738

     

  • Highboy Profile Picture
    1,185 Super User 2024 Season 1 on at

    There are many ways to accomplish this, and one is using the power of Powershell.
    You can feed the "run powershell scupt" with any date and get the weeknumber.
    Dateformat to feed the powershell script is MM/dd/yyyy

    Highboy_1-1639179530815.png

     

     

  • AlexScharpé Profile Picture
    35 on at

    I am currently experiencing the same problem in PAD where I need to find the numeric week we are in. An out of the box solution I might go for is to visit a website like https://www.epochconverter.com/weeknumbers and spy the week number as a UI element. You could try the same with the day number..

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard