Daylight saving with historical reporting data - dst

TL;DR Is there a simple way to handle daylight saving timezone for historical data ?
We have a list of timezone along with thier offset to UTC which is changed for certain zones as per DST timings. All the data is stored in UTC but displayed as per the user timezone. The issue is when DST is active or reverted the historical data view also changes . This creates a discrepancy in customer reporting in terms of billing and order counts.
Is there a standard way of handling this ?

Related

Data disappears when moving from events_intraday_ to events_

I am using BigQuery to analyze FirebaseAnalytics events. I use events_intraday_ for real-time analysis and events_ for daily analysis, and the data is automatically transferred from events_intraday to events_ after a certain time, but some data will disappear at that time. The table exists, but the data is clearly reduced. About 2 days out of a week's data is lost here. Please tell me why this happens.
Thanks.
Data should not be lost when moved from events_intraday_ to events_.
A common problem that is easy problem fix is with the set up of intraday collects the data from “today” in realtime, you first need to agree with Google BigQuery on what “today” refers to. BigQuery can’t guess what timezone you want to query, which is why the default UNIX timestamp format of the event_timestamp column in BigQuery is always in UTC time. this post explains it clearly Firebase BigQuery server offset time
Also I am not sure your last statement is correct "events_intraday_" and "events_" are not quite the same thing, an "events_intraday_" table contains raw, unsampled event data for the current day while the "events_" table contains processed and aggregated event data.
This processing of data after its collected but before data is exported to BigQuery, this means you would expect some data to be lost. Generally, the affected fields are traffic sources and linked marketing products (AdWords, Campaign Manager, etc.), if these are areas you are looking at its probably a GA4 processing issue.

React Table shows entries based on User Time zone not UTC

I have a table (react/Nodejs) which reads the entries from db and list it in the table. All entries in db are UTC, however depending on the user time zone the table is showing different data. For example in the attached snapshot our week on header is from Sep 19 to Sep 25 but the table shows Sep 26 entry which is outside of the range. That only happens with users on (UTC-xxx) time and not for user on (UTC+xxx). Your help is appreciated? Table Image
Use a timezone library to render it with a specific timezone
The problem is caused when formatting the object to be rendered in the UI, so probably the method you are using is as you say taking into account the users timezone and not a specific one that you set.
To achieve this, you can use a library like moment timezone. Or a variant compatible with your libraries.
Hope it helps.

Query table based on users local hour, rather than GMT hour (including daylight savings support)

If users want notifications or certain activities triggered based on an hour of the day in their local timezone. You could store each users preferred notification hour in the database, and just poll the table every hour for who wants a notification. But this won't take daylight savings into account. How is this normally solved?
Assuming the user requests 9am EST:
If you convert 9am EST to GMT, and store the GMT hour in the database. This doesn't work, because that GMT conversion is only valid until daylight savings time.
If you store 9am EST directly in the table, then you have to query every single row in the table including their timezone and calculate the current time in every row.
Option 2 works, but only for a small database. What is the best way to do this?
One option would be to store the hour in GMT, so you can batch/segment the table into 9am, 10am, etc...
Then, every time you do a notification, you recalculate tomorrows time, so that the day before Daylight Savings, not only will the notification be sent, but the hour will be updated in preparation for tomorrow.
The only catch to this solution is that if you have a large segment (i.e. US), then there will be a large bulk update occurring on certain days of the year.

How to find day light time saving is active and save time in SQL for UK?

I am looking to save current UK time and problem is they have two timezone GMT and BST accordingly day saving light ?
I am saving time in SQL date time column from mobile app and SQL server. I am insert time using SQL.

Local Time & UTC Confusion C#, SQL Server

I am storing all dates to SQL Server as a UTC date time. I have Time Zone Id for each user stored in user profile as well.
Now when user requests data back, I want to display local time of user for each record using the Time Zone I have stored in profile for the particular user.
What is an easiest and optimized way (as I am processing heaps of records at the same time) to convert all dates and time to particular time zone on the fly while returning data? Either in SQL or in C# would be fine...
Very important question is, let's say there is a record created from Sydney when there was Day Light Saving "ON" and now Day Light Saving is "OFF". As the record was created when Day Light Saving was "ON", will it still convert the same time or will it return conversion as per current time zone status (which is Day Light Saving is "OFF")???
People only see those records which they had created from the particular
let's say there is a record created from Sydney when there was Day Light Saving "ON" and now Day Light Saving is "OFF". As the record was created when Day Light Saving was "ON", will it still convert the same time or will it return conversion as per current time zone status (which is Day Light Saving is "OFF")
The record contains an UTC date and time. This is going to fall into a DST ON or DST OFF period, deterministic. Is irrelevant whether the DST is in effect now. The opposite (storing local time, trying to extract UTC) is undetermined because of the overlap times when the DST changes (a small range of local times cannot be deterministically converted to UTC if they fall into the 60 mins that occurs twice when DST come into effect, assuming a 60 min DST).
As for the question: transform the date in your presentation layer. Use TimeZoneInfo.ConvertTimeFromUtc.