cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SimonMeadows
Level 8

Time() off by 1 hour

I have a small issue with the Time() function.

 

If I have a label:

Text: Time(00,00,00) 
the result I get is "00:00" as expected

If I have:

Text: Value(Time(00,00,00))
the result I get is "-3600000"

This is one hour out

If I have:

Text: Text(Time(00,00,00),DateTimeFormat.UTC)
the result I get is "1969-12-31T23:00:00.000Z"

Also 1 hour out.

 

I would have expected the time function to return the correct time based on the numbers entered but it does not.

There appears to be a difference between the timezone of the Time function and the ISO time.

My system is set to ISO+00 so all time should be ISO.

Is there a way to determine the timezone the Value() function is using?

 

2 REPLIES 2
Highlighted
SimonMeadows
Level 8

Re: Time() off by 1 hour

Adding more info, getting a better understanding of what's happening.

 

I figured I could use the TimeZoneOffset() to get more useful diagnostics.

If I have:

TimeZoneOffset(Time(00,00,00))
the result I get is -60

The time is off by 1 hour

If I Have:

TimeZoneOffset(Now())
the result I get is 0

My current timezone is proved to be UTC+00

...

...

So after explaining this to a few colleagues, I have found the problem.

The Time() function creates, not a 'Time' data type but 'DateTime' using the Unix epoch of 01/01/1970 as the date portion and the values from the Time() function as the time portion.

In the UK we have daylight savings time usually UTC+1 hour in March/April then back to GMT/UTC in October...

Still confusing as the 1st of Jan should be at a UTC time, not +1 hour.

 

However, and it's a big, however... 

In 1968 the UK did not revert to GMT/UTC in October. The timezone stayed UTC+1 until October 1971, meaning that because the Time() function respects the historic timezone changes, any 'DateTime' derived from the Time() function in the UK will always have the timezone offset UTC+1

 

I guess the simple solution is to just remove the TimeZoneOffset, but remember that it will always be off by 1 hour when trying to work with purely time portions of the DateTime

Super User
Super User

Re: Time() off by 1 hour

I can barely wrap my head around Time issues without diagrams and months of tutalege... but... you may try yourTimeValue - Time(1,0,0) to get rid of that pesky hour thats plaguing you!

Good luck!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 79 members 4,473 guests
Please welcome our newest community members: