cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Community Support
Community Support

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
Highlighted
Community Support
Community Support

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
Helper I
Helper I

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!!

Highlighted
Community Support
Community Support

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
Check this Out

Announcing

Class of 2020- Season 2

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,212)