cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kbieber
Level: Powered On

Date picker loses a day after record is patched to SQL

I have a gallery with a datepicker control writing to SQL with the gateway to an on-prem SQL Server.  When I patch the record to SQL, the date picked is posted correctly, however the date picker in the gallery then decrements by 1 day.   If the user patches again, the new date is updated to SQL and the date picker control then shows date -1 day.  This happens every time the patch function is executed. 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Date picker loses a day after record is patched to SQL

Hi @kbieber ,

Could you please share a bit more about your scenario?

Which type date column do you use to store the DatePicker date value within your SQL Table? Is it the datetime type?

 

Based on the issue that you mentioned, I suppose that you added a datetime type column in your SQL Table to store the DatePicker date value from your app, is it true?

It is an known issue that, when you datetime column value of SQL Table within PowerApps, you may have the offset issues. Please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/

 

The user @CFVieira has faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Date-Value-is-reading-wrong-form-SQL-Server/m...

 

As an fixed solution, you could consider take a try to add a datetimeoffset type column in your SQL table to store the Date value (picked from your app) instead of datetime type column.

In addition, if you have already used datetime type column to store Date values, and don't want to add other date type column in your SQL table, I think the TimeZoneOffset function could achieve your needs. Set the DefaultDate property of the DatePicker control to following:

DateAdd(ThisItem.DateTime, TimeZoneOffset(ThisItem.DateTime), Minutes)

Please consider take a try with the fixed solution mentioned within above blog I mentioned to achieve your needs.

 

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

1 REPLY 1
Community Support Team
Community Support Team

Re: Date picker loses a day after record is patched to SQL

Hi @kbieber ,

Could you please share a bit more about your scenario?

Which type date column do you use to store the DatePicker date value within your SQL Table? Is it the datetime type?

 

Based on the issue that you mentioned, I suppose that you added a datetime type column in your SQL Table to store the DatePicker date value from your app, is it true?

It is an known issue that, when you datetime column value of SQL Table within PowerApps, you may have the offset issues. Please check and see if the following blog would help in your scenario:

https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql/

 

The user @CFVieira has faced same issue with you, please check my response within the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/Date-Value-is-reading-wrong-form-SQL-Server/m...

 

As an fixed solution, you could consider take a try to add a datetimeoffset type column in your SQL table to store the Date value (picked from your app) instead of datetime type column.

In addition, if you have already used datetime type column to store Date values, and don't want to add other date type column in your SQL table, I think the TimeZoneOffset function could achieve your needs. Set the DefaultDate property of the DatePicker control to following:

DateAdd(ThisItem.DateTime, TimeZoneOffset(ThisItem.DateTime), Minutes)

Please consider take a try with the fixed solution mentioned within above blog I mentioned to achieve your needs.

 

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

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,697)