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 Apps / Default Time Not Updat...
Power Apps
Unanswered

Default Time Not Updating Correctly

(0) ShareShare
ReportReport
Posted on by 278

For this datacard in my app, I have it set so that by default, the current date/time of the user using this, will be displayed.

They still have the option of changing it, but by default it should should current date and time.

I am in CST time zone.

I set this up yesterday afternoon.  It was working perfectly.

The only difference is time, as I was doing this change around noon or after yesterday, CST.

 

I came in this morning to work on the app, and noticed that the default date and time is no longer working.  Nothing has changed.  It is 6am CST right now. 

 

Something is wrong somewhere but I can't find it or figure it out.  Here is the current setup.

Yesterday default would be hour and minute, now only date is working, and I have 00 for both Hour and Minute.

 

UPDATE:  Something I just noticed.  It is currently 6:15am CST.  I found that when testing, when it was 6:10am, it showed all zeroes.  Once it hit 6:11am, the minute changed from 00 to 11.  Seems that if the minute is 0-10, it shows 00.  Anything after, and it works correctly.

I am going to assume hour is the same way (I expect this to work after 11am CST).

Any idea what is causing that?

 

Travis5150_0-1642075691111.png

 

Travis5150_1-1642075738703.png

 

Travis5150_2-1642075761190.png

 

Travis5150_3-1642075787236.png

 

Travis5150_4-1642075842032.png

 

 

Categories:
I have the same question (0)
  • Travis5150 Profile Picture
    278 on at

    one thing I just noticed from testing.

    If I change the Items for the hour card from:

    ["00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]

    and remove the 0 so the format is this:

    ["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"]

    The hour changed to 6, which would be the correct time when I ran the test.

     

    So couple of things.

    Will anything with a zero, like midnight and 10 not work?

    Is there a way to change it from military to 12 hour so that I dont have to deal with this (12hr would be ideal)

    I dont understand why the zero seems to be causing the issue.

  • Travis5150 Profile Picture
    278 on at

    I found one of @RandyHayes posts, and am trying that right now to accomplish two things:

    Set the DEFAULT time when the screen opens

    Change from military to 12hr time format.

     

    Set the DatePicker DefaultDate to : Today()

    For the Hours dropdown:

        Set the Items property to: Sequence(12)

        Set the Default to: With({_hr:Hour(Now())}, If(_hr>12, _hr-12, _hr))

    For the Minutes dropdown:

        Set the Items property to: ForAll(Sequence(60, 0), Text(Value, "00"))

        Set the Default to : Text(Minute(Now()), "00")

    For the AM/PM Dropdown:

        Set the Items property to : ["AM", "PM"]

        Set the Default property to: With({_hr:Hour(Now())}, If(_hr>11 ||_hr=0, "PM", "AM"))

     

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Add-Hours/td-p/912291

     

    I will see how this goes.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Travis5150 

    Yes...glad you found that post.  That was what I was about to mention to you.

    The big thing is the Default property on the dropdown.

     

    Are you doing 12 or 24 hour format?  The post you reference was specifically for 12 hour format (which means adding an AM PM dropdown)

  • Travis5150 Profile Picture
    278 on at

    So it WAS 24hr.

    The first thing I wanted to do was default the time, so that when this screen opened, it auto populated the time to what the current time of the user was.  If they needed to change the time for whatever reason they still could.

    I had found a microsoft document on using today(), Hour(now()), etc...

    This worked.

    The problem is when I came in this morning, I was find that with the 24hr format, if the time began with a zero, it would NOT update to the current time.

    For example, if the time was 3:00am, in 24hr time that was 03.  So it would not update the hour.  Same with minutes.

    Once I realized that, I thought lets just go to 12hr, its easier for the user anyways.

    So I added the AM/PM drop down.

    I am still running into the problem though with the zero, for minutes.

    I kept checking the app, during the 9am hour, it kept updating.  Once 10am hit, it updated again, so i was happy.  Until I checked it at 10:02am.  Because the minute starts with a zero, it did not update, it stayed at 00.

    So that is the problem I have now.  How do I get the minute to update, if the minute is 01-09?

     

    Travis5150_0-1642090793482.png

     

    Travis5150_1-1642090818155.png

     

     

    Travis5150_2-1642090837563.png

     

     

    Travis5150_3-1642090857065.png

     

    Travis5150_4-1642090874083.png

     

    (side note, I am going to be posting about converting timezones in a specific way, but will make that post when this is resolved 🙂 )

     

     

     

  • Travis5150 Profile Picture
    278 on at

    I found another one of @RandyHayes  posts.  I am trying this.

    SO FAR...it is working.  Going to monitor.

    On my minutes drop down, I changed Default to Text(Minute(Now()), "00")

    I was checking it at 11:01 though 11:11, it updated each time.

     

    Travis5150_0-1642093937636.png

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Leading-zeros/td-p/655013

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Travis5150 

    Yes, if your Hour is going to be, let's say, 6.  Then this will not match 06.  Dropdowns are ALWAYS text.  So, there is no conversion from text to number.  So the key is to make sure the Default on the dropdown is set to convert to text in the format of the items.  Since we are looking to match 6 to 06, then Text(Hour(Now()), "00") will convert (if the hour is 6) to 06...which is text that will match the text of the items.

     

    The same goes for Minutes.  Text(Minute(Now()), "00") will match the minute.

     

    So, it is all about matching text to text.  

    When using a 12 hour format, it is a little more user friendly to show single digits with no leading zero.  In 24 hour format, the leading zeros are more welcome.

    So, the Conversion to 03 in the Default is not needed (for example).

     

    The minutes though are always prepended with a Zero.  So the text conversion is needed there always.

     

  • Travis5150 Profile Picture
    278 on at

    Thanks man, I will mark you last post as solution once I have confirmed all is working.

    Going to let it run today and check again in the morning.

    Thanks again.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Travis5150 

    How did it go?  Everything working properly now?

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!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard