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

Date time zone issue while storing data to SQL Server database.

Hello,

 

I have powerapp connected to SQL Server table(on-premises).

 

I am storing datetime value(UTC-Powerapp) to datetime Sql Server.

 

Facing so many issues here,

 

When I create record from India(IST Timezone)

 

I select 8 AM in powerapp field.

It stores 2 AM in database.

When fetching back on display form it returns: 7:30AM.

 

When Jerry does same from USA Chicago:

 

Jerry select 8 AM in powerapp field.

It stores 2 AM in database.

When fetching back on display form it returns: 8PM.

 

I cant even change column to datetimeoffset as its existing database table.

 

I am really confused, any kind of help would be appriciated.

Thanks 🙂



1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Date time zone issue while storing data to SQL Server database.

Hi @SudhirSingare,

Do you want the Time value from your SQL table to be displayed with same value within your app?

Based on the issue that you mentioned, I think you have faced a Time Zone offset issue within your app.

When working Date Times within PowerApps, the Date Times value would be converted into UTC format.

In other words, when you retrieve 2 AM time value (from your SQL Table) within your app, the 2 AM time value would be recognized as a UTC format, when you display it within your app, it would be converted into your local Time Zone.

If the users of your app is in different time zone, and you want the Date Time value from your SQL table to be displayed with same value, I afraid that there is no way to achieve your needs in PowerApps currently.

Currently, as an alternative solution, you should create a datetimeoffset column in your SQL table to store the Date time value from your app. 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/

 

In addition, you could consider take a try to display the UTC time value within your app instead of user's local time value, then the end users would display same UTC time value within their own app.

If you want to convert a Time value into UTC format, I think the DateAdd function and TimeZoneOffset function could achieve your needs:

DateAdd(YourTimeValue, TimeZoneOffset(), Minutes)

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff#con...

 

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

3 REPLIES 3
Community Support Team
Community Support Team

Re: Date time zone issue while storing data to SQL Server database.

Hi @SudhirSingare,

Do you want the Time value from your SQL table to be displayed with same value within your app?

Based on the issue that you mentioned, I think you have faced a Time Zone offset issue within your app.

When working Date Times within PowerApps, the Date Times value would be converted into UTC format.

In other words, when you retrieve 2 AM time value (from your SQL Table) within your app, the 2 AM time value would be recognized as a UTC format, when you display it within your app, it would be converted into your local Time Zone.

If the users of your app is in different time zone, and you want the Date Time value from your SQL table to be displayed with same value, I afraid that there is no way to achieve your needs in PowerApps currently.

Currently, as an alternative solution, you should create a datetimeoffset column in your SQL table to store the Date time value from your app. 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/

 

In addition, you could consider take a try to display the UTC time value within your app instead of user's local time value, then the end users would display same UTC time value within their own app.

If you want to convert a Time value into UTC format, I think the DateAdd function and TimeZoneOffset function could achieve your needs:

DateAdd(YourTimeValue, TimeZoneOffset(), Minutes)

Please check the following article for more details:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-dateadd-datediff#con...

 

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

Highlighted
SudhirSingare
Level: Powered On

Re: Date time zone issue while storing data to SQL Server database.

@v-xida-msft 

 

I have solved this issue by creating "datetimeoffset" type column is sql server table.

 

Thanks for informative post Though!!

Community Support Team
Community Support Team

Re: Date time zone issue while storing data to SQL Server database.

Hi @SudhirSingare,

If you have solved your problem, please 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.

Helpful resources

Announcements
thirdimage

Power Automate 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

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (6,095)