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 Automate
Unanswered

Week number, in pad

(0) ShareShare
ReportReport
Posted on by 63

How do I get the current week number in PAD?

I have the same question (0)
  • MichaelAnnis Profile Picture
    5,727 Moderator on at

    I assume you mean the week of the year.  Below says '(Today - 1/1/(of this year) in Days) / 7; rounded up = the week of the year we are in:

     

    MichaelAnnis_0-1630089526141.png

     

    I tested this for "CurrentDateTime = 1/8/21" and it brought back week 2 and tested it for "CurrentDatetime = 1/7/21" and it brought back week 1.  So, it should work.  As a double check, I got Week 35 of the year.

     

    Depending on how you want to deal with what classifies as a week, you may need to adjust the start date each year.  So, how 1/1/21 was on a Friday, but you want all weeks to start on Monday, then you will need to delete the 1/1/%Today_yy% and just replace it with 12/28/20 so that week 1 starts on that Monday.  If you do this, you will need to remember to replace it each year.

     

    Best of luck!

     

  • tkuehara Profile Picture
    667 on at

    Hi @roccolord 

     

    You can use Python in PAD:

    tkuehara_0-1630417576754.png

    tkuehara_1-1630417596058.png

    import datetime
    week = datetime.date(%CurrentDateTime.Year%, %CurrentDateTime.Month%, %CurrentDateTime.Day%).isocalendar()[1]
    print(week)

    Please notice it uses the ISO week date standard (ISO-8601), which means that if you try to run this script with 1/1/2021, it will return week 53:

    tkuehara_2-1630417775812.png

    If you want to consider 1/1/2021 the first week, then you need to adjust the code:

    import datetime
    week = datetime.date(%CurrentDateTime.Year%, %CurrentDateTime.Month%, %CurrentDateTime.Day%).isocalendar()[1]
    first_week = datetime.date(%CurrentDateTime.Year%, 1, 1).isocalendar()[1]
    if first_week == 52 or first_week == 53:
     if %CurrentDateTime.Month% == 1 and week == 52 or week == 53:
     print(1)
     else:
     print(week+1)
    else:
     print(week)

    tkuehara_4-1630418743244.png

     

    tkuehara_3-1630418688744.png

    Please also notice this week number system considers the starting on Monday and ending on Sunday.

  • roccolord Profile Picture
    63 on at

    nice thanks!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 376

#2
Valantis Profile Picture

Valantis 361

#3
David_MA Profile Picture

David_MA 294 Super User 2026 Season 1

Last 30 days Overall leaderboard