cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

date is different between data source and date picker selected

Hello 

 

i am building an app to record information, my date picker default is Today(),  but after saved, the date is minus 1 day compare today() in my data source (excel file). but when i display the record in gallery, the date is my submit date.

 

for example: ID 197 and 198, date is 5/11/2020 12:00 AM in Gallery shown, but the date is 5/10/2020 16:00 in data source.

could someone help me solve this issue?

GalleryGallerydatasourcedatasource

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Bruce_Fei ,

Based on the issue that you mentioned, I think this issue is related to Time Zone. Based on the issue that you mentioned, I have made a test, and the issue is confirmed on my side.

 

When saving date time value back to Excel table from canvas app, it would convert the submitted date time value from canvas app into UTC format, then save the UTC format date time value back to Excel Table.

 

I have made a test on my side, please consider take a try with the following workaround:

12.JPG

 

13.JPG

Within the Edit form, set the Update property of the Date time field data card to following:

DateAdd(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), -TimeZoneOffset(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)), Minutes)

set the Default Property of the Date Time field data card to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

If you want to reference the stored Date time value from your Excel table in Gallery, please use the following formula:

13.JPG

Set the Text property of the Label to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

Within your Detail Form, set the Default property of the Date time field data card to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

10 REPLIES 10
Super User II
Super User II

Hi @Bruce_Fei ,

 

Could you explain how are you are saving your data and what is the back end (sharepoint list, SQL / Excel?). That will give us little more clue to help you.

 

Regards,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

 

Hi, @KrishnaV 

I using excel file for my data source and stored in one drive. first screen is new record screen, second is my save code, i am using collect function. and date time zone is Local for date picker.

New Record.JPGCode.JPG

Ok this I can see the locatime and date issue. Is your PowerApps environement is local to you? if not this is expected. Try this DateAdd(InputDate.Selected,TimeZoneOffset(),Minutes) this will convert the date & time with respect to your calendar.

 

Follow the below article from MS:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff

 

Note: If this helps mark it as the solution.

 

Regards,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi, @KrishnaV 

i try code "Date:DateAdd(InputDate.SelectedDate,TimeZoneOffset(),Minutes)", now the date shown are same day between gallery list and data source, but different time.

but the day of date is still not my timezone. my time is 5/11/2020 3:00 PM.  how to adjust this code?

Gallery1.jpgdatasource1.jpg

Community Support
Community Support

Hi @Bruce_Fei ,

Based on the issue that you mentioned, I think this issue is related to Time Zone. Based on the issue that you mentioned, I have made a test, and the issue is confirmed on my side.

 

When saving date time value back to Excel table from canvas app, it would convert the submitted date time value from canvas app into UTC format, then save the UTC format date time value back to Excel Table.

 

I have made a test on my side, please consider take a try with the following workaround:

12.JPG

 

13.JPG

Within the Edit form, set the Update property of the Date time field data card to following:

DateAdd(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), -TimeZoneOffset(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)), Minutes)

set the Default Property of the Date Time field data card to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

If you want to reference the stored Date time value from your Excel table in Gallery, please use the following formula:

13.JPG

Set the Text property of the Label to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

Within your Detail Form, set the Default property of the Date time field data card to following:

DateAdd(ThisItem.'Due Date', TimeZoneOffset(), Minutes)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Bruce_Fei,

 

@v-xida-msft has explained with an example on the same function which I have proposed to you and I was also able to achieve the same.

Please let us know if you still experience any issue.

 

Note: If my proposal/advice helps, please mark it as the solution.

 

Regards,

Krishna


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Proud to be a Super User!

Regards,
KrishnaV
Business Applications MVP
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

Hi @Bruce_Fei ,

Have you taken a try with the solution I provided above?

 

Based on the issue that you mentioned, I think above solution I provided could achieve your needs. Please take a try with it, check if the issue is solved.

 

If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-xida-msft 

 

I had same problem, i tried your solution, but it gave me error, when implementing code in "Update" in this piece of code - 

 

DateAdd(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0), -TimeZoneOffset(DateValue1.SelectedDate + Time(Value(HourValue1.Selected.Value), Value(MinuteValue1.Selected.Value), 0)), Minutes)

 

 

The error i got: expected a valid date value as a parameter to 'timezoneoffset' powerapps, recieved value: null

 

Any idea on this.

 

Thanks in Advance,

Shreyansh Parihar

Hi @Shreyansh ,

Please set default value within your DateValue1 (DatePicker control). Set the DefaultDate property of the DateValue1 to following:

Today()

then try above formula again, check if the issue is solved.

 

@Bruce_Fei have you taken a try with the solution I provided above? Is it helpful in your scenario?

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (9,645)