Skip to main content
Community site session details

Community site session details

Session Id : L+7YKI1wq7hLPk4sfRLpzr
Power Apps - Building Power Apps
Unanswered

getPastTime(1, 'Month') returning wrong month

Like (2) ShareShare
ReportReport
Posted on 1 Oct 2019 09:05:42 by 6

I have a monthly flow that adds a row into an enitity for all users. the formula i use is: getPastTime(1, 'Month')

 

This formula doesn't return September though. I created a seperate flow that use emails me the details

 

The result of the mail is:

-1 = August 2019
Formula = formatDateTime(getPastTime(1, 'Month'), 'MMMM yyyy')
-2 = August 2019
Formula = formatDateTime(getPastTime(2, 'Month'), 'MMMM yyyy')
-3 = July 2019
Formula = formatDateTime(getPastTime(3, 'Month'), 'MMMM yyyy')
-4 = June 2019
Formula = formatDateTime(getPastTime(4, 'Month'), 'MMMM yyyy')

 

I can't see what i am doing wrong here.

Categories:
  • glogic Profile Picture
    2 on 04 Jul 2022 at 16:14:15
    Re: getPastTime(1, 'Month') returning wrong month

    Function getPastMonth relies on utc.

    If you're at another time zone, it is better to use subtractFromTime(convertFromUtc(utcnow(), 'Your time zone'), 1, 'Month').

  • Simon_P Profile Picture
    6 on 02 Oct 2019 at 08:20:00
    Re: getPastTime(1, 'Month') returning wrong month

    Morning @v-xida-msft,

     

    I've not been able to test this properly yet, as when i use the erroring formula, it is returning the correct data today (2nd Oct). I will need to test again on the 1st.

     

    When it comes to adding the date into an Entity as a date, the formula you gave doesn't work, as it throws the below error:

    "message": "DateTime is less than minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00",

     

    What should i be using to get last month as a date (for entry to an entity)

     

  • v-xida-msft Profile Picture
    on 02 Oct 2019 at 02:26:29
    Re: getPastTime(1, 'Month') returning wrong month

    Hi @Simon_P ,

    Based on the issue that you mentioned, I have made a test on my side, and don't have the issue that you mentioned. The screenshot as below:1.JPG

    The result as below:2.JPG

    set the Inputs field of the "Compose" action to following:

    getPastTime(1,'Month','MMMM yyyy')

    set the Inputs field of the "Compose 2" action to following:

    subtractFromTime(utcNow(),1,'Month','MMMM yyyy')

    Note: It is not necessary to add additional formatDateTime() function to convert the date time value.

    On your side, please consider take a try with above subtractFromTime(...) formula, then check if the issue is solved.

     

    If the issue still exists, please consider take a try with the following formula within your flow's action:

    addDays(utcNow(),-31, 'MMMM yyyy')

    then check if the issue is fixed.

     

    Best regards,

  • npalmer610 Profile Picture
    9 on 01 Oct 2019 at 15:44:36
    Re: getPastTime(1, 'Month') returning wrong month

    I'm having the same issue. Hope someone can get back about this. The expression I'm using is 

    getPastTime(1, 'Month', 'MMMM') and that returns August 2019 instead of September 2019.

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

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 791 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 410 Super User 2025 Season 2

#3
mmbr1606 Profile Picture

mmbr1606 275 Super User 2025 Season 2

Loading complete