cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SudhirSingare
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
v-xida-msft
Community Support
Community Support

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
v-xida-msft
Community Support
Community Support

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

SudhirSingare
Helper I
Helper I

@v-xida-msft 

 

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

 

Thanks for informative post Though!!

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (40,727)