cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PhilD
Kudo Kingpin
Kudo Kingpin

Daylight savings time problem - one hour off

 

I have a PowerApps form that sets the date and time for a SharePoint list item. The update property for the data card is shown below, referencing the three controls on the card.

 

Until today, this had been working fine for thousands of items entered but since daylight savings time (I'm in Eastern Standard time zone), this method of combining the date, hour & minute results in a time that is one hour ahead of the correct time.

 

//update property of datacard
DateValue3_1.SelectedDate + Time( Value(HourValue3_1.Selected.Value), Value(MinuteValue3_1.Selected.Value), 0 )

 

For example, the user enters 3/10/20019  08:44 as shown below and the SharePoint list item is updated to 3/10/20019  09:44

DaylightSavingsTime.png

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@PhilD 

Your results are actually correct based on your formula.

If you add 8:44 to 12:00 on 3/10/2019 you will get 9:44.  Because the time changed, there is 1 hour lost.

If you add 1 hour to 12:00 on 3/10/2019 you get 1:00 AM

If you add 2 hours to 12:00 on 3/10/2019 you get 3:00 AM (time change at 2:00 AM)

If you were to add 8:44 to 2:00 on 3/10/2019, you would get 10:44 because it is after the time change at 2:00 AM (no hour lost).

 

I hope this sheds some light for you...just in time!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@PhilD 

Your results are actually correct based on your formula.

If you add 8:44 to 12:00 on 3/10/2019 you will get 9:44.  Because the time changed, there is 1 hour lost.

If you add 1 hour to 12:00 on 3/10/2019 you get 1:00 AM

If you add 2 hours to 12:00 on 3/10/2019 you get 3:00 AM (time change at 2:00 AM)

If you were to add 8:44 to 2:00 on 3/10/2019, you would get 10:44 because it is after the time change at 2:00 AM (no hour lost).

 

I hope this sheds some light for you...just in time!

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Very good, thank you for this answer! I hadn't properly considered that the 12:00 part of the date was actually denoting a time prior to the time change.

 

Before reading this, I rushed out a fix using the code below which is working fine (for reasons related to your answer I suppose). This builds and populates a proper date time value in the SharePoint list column. Let me know if you think there are any other implications of using this...

 

DateTimeValue(
    DateValue3_1.SelectedDate & 
    " " 
    &
    Time(
            Value(HourValue3_1.Selected.Value), 
            Value(MinuteValue3_1.Selected.Value), 
            0
        )
)

@PhilD 

Yes, that should work for you because there, you are building the date/time as a string rather than calculating it. Then, obviously, converting it to a value.  Which is, I believe, what you really wanted to begin with - actual 8:44 rather than 12:00 + 8:44.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Yes, you are right. This is actually more precisely what I wanted all along.

 

Thanks again for helping me understand why this happened.

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (95,781)