cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TheRydad
Advocate I
Advocate I

Date displayed is one day off

I must be doing something stupidly dumb here, and I am hoping someone can nudme me in the right direction.

 

I have an Excel file with a table that includes a date field. In my "edit" form, I am using a DatePicker control wired to the "Date" field in the table. I can input a new record or update an existing one with no problems and the selected date gets into the table correctly. The problem is that when I view the records in a Gallery or otherwise pull the record up later, the date is early by one day.

 

If I display the date in a text control, it is formatted like this: "2016-05-12T00:00:00Z". The DatePicker control will, in this example, be displaying "5/11/2016". The record in the Excel table is "5/12/2016". I suspect the issue is with a time zone conversion. In fact, if I manually change the record in the Excel table to "5/12/2016 08:30", that record then displays as expected. I am in the US central time zone.

 

Has anyone encountered this before? If so, did you engineer any kind of "solution"?

 

I am probably going to whip up a formula to add the hour and minute to the field using Now() and Text(), but would love to hear anyone's thoughts.

 

Note- recording the time is not really essential for my purposes, but it wouldn't hurt to have it. I am also thinking of adding drop down controls for selecting the time (this is meant to be a mobile app, so trying to avoid a lot of text entry).

 

Thanks!

 

-rd

20 REPLIES 20
Anonymous
Not applicable

Here is a solution which is working for me :

 

I use an Excel database, with a date column, and a form. where user can interact with.

 

To write date in my database (excel sheet), from my Powerapps application, i use -TimeZone :

 

DateAdd(

     MyDatePicker.SelectedDate ;

     -TimeZoneOffset() ;

     Minutes

)

 

Then, i send the result to my database.

 

To write date in my powerapp application from my database (excel sheet), i use same with +TimeZone :

 

DateAdd(

     LookUp(

            MyExcelSheetTable;

            [conditions];

            MyDateColumnInMyExcelSheetTable

     );

     TimeZoneOffset() ;

     Minutes

)

 

 

 

This is working well for me, and i haven't any date problem. Try it too.
You can refer to this page for more details : 

DateAdd, DateDiff, and TimeZoneOffset functions in Power Apps - Power Apps | Microsoft Docs

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (1,564)