Convert UCT to British Summer Time Athena - presto

I'm working with a data set in Athena where all the timestamps are UTC, but I need to adjust to British Summer Time, i.e. add an hour for all timestamps between 1:00am on the last Sunday in March and 1:00am on the last Sunday in October. Any help would be much appreciated. Thanks!

List of supported time zones does not contain BST but has Europe/London which AFAIK should match it. To convert time zone use AT TIME ZONE:
-- sample data
WITH dataset (time) AS (
VALUES (timestamp '2022-02-01 10:00:00'),
(now())
)
-- query
select time, time AT TIME ZONE 'Europe/London'
from dataset
Output:
time
_col1
2022-02-01 10:00:00.000 UTC
2022-02-01 10:00:00.000 Europe/London
2022-04-13 12:13:06.610 UTC
2022-04-13 13:13:06.610 Europe/London

Related

Excel formula to determine shipping date

Due to production and shipping issues my job has created a report that has the customer's need by date and if a product has been completed or not. If an order is complete we need to determine when it will ship out and arrive to the customer. We have a set shipping schedule and orders get shipped on the truck right before the need by date. For example our truck leaves on Monday and Friday every week so if an order is complete and the need by date is on a Wednesday it will ship on Monday so any order with a need by date from Tuesday to Friday gets shipped the Monday before and any need by date from Saturday to Monday gets shipped on Friday. Now my questions is, is there a way to have a date range yield it's shipping date? Example when I'm writing this it's 5/11/2022 so if I have completed orders with need by dates of 5/12 and 5/15 all of which should be on the 5/13 truck could I use a formula to fill in the shipping date for those need by dates? We've been doing it manually and although determining the dates isn't difficult it's time consuming when each report has over 3000 lines and there is a report for each customer. If it's not possible then we won't have a choice but I would like to hope so. Please help.
The third column is just to show that the ship dates are on the correct day. It looks different because the dates are Australian (DD/MM/YYYY) rather than American (MM/DD/YYYY), but that shouldn't matter for the function to work.
The function in the Ship Date column:
=IF(OR(TEXT(A8,"dddd")="Tuesday",TEXT(A8,"dddd")="Wednesday",TEXT(A8,"dddd")="Thursday",TEXT(A8,"dddd")="Friday"),A8-WEEKDAY(A8,3),A8-WEEKDAY(A8+2,2))
Need By Date (including header) = A7:A20
Ship Date (including header) = B7:B20
Explanation
TEXT(value, format_text): this is used to convert the date (DD/MM/YYYY) to the long day (e.g. Monday)
Breakdown
IF the day is Tues, Wed, Thurs, or Fri
THEN return the date of that weeks Monday
ELSE return the date of that weeks Friday

I have to convert utc time to ist in excel

I have to convert utc time to ist time in my excel the the time format is 10:00:00 utc this has to converted in IST timing.
Please suggested
There are no inbuilt functions that identify/convert the timezones. We can extend the capabilities of Excel Time() function to solve this use case.
=A1+Time(5,30,0)
For IST, you will have to add 5 hours and 30 minutes. Similarly, you can convert to any timezone by adding/subtracting the time difference.
The three inputs given to the Time() are hours,minutes and seconds.
This function returns the timestamp in a serial number format. Excel will interpret this number and show the timestamp in a readable format.

Convert day, hour and minute to UTC - node.js

I will get time input from the user for scheduling a task. The options are as follows,
Day of the week, hour and minute (or)
Day of the month, hour and minute (or)
Month of the year, hour and minute (or)
User can be in any timezone. I have modeled my database table to store the user input as a configuration.
In my table I will calculate the next_run_at and populate it, so that poller can find the jobs to run based on it and execute.
To be timezone agnostic, my next_run_at should be in UTC.
Is there a way to convert the above mentioned configuration(Day, hour, minute) alone in UTC and store it?
TL;DR I know we can convert a date to specific timezone. Is there a way to convert the combination of just day, hour and minute alone to UTC?
Construct a date from the day, hours, and minutes you have. Convert it to UTC and get the day, hours, and months values back.
But I think there will be edge cases as to which month the day corresponds to.
23:00 28th Feb PST will be 06:00 1st Mar UTC;
23:00 28th Mar PST will be 06:00 29th Mar UTC
You asked:
Is there a way to convert the combination of just day, hour and minute alone to UTC?
No, there is not a general way to do that. You must have the full date and time, including year, month, day, hour and minute. Otherwise you cannot be certain if daylight saving time is in effect, or if the standard time has changed.
You will have to assume some of the data you don't have. For example, you could make an assumption that the data is relative to "now". Just understand you will get different results depending on when you run the code.
Of course, this doesn't apply if there's only a single fixed offset for the time zone in question, such as Arizona being fixed to UTC-7. Just you can't assume this in the general case of any time zone of the world.

Mongodb time series data and time zone handling

I'm creating using node.js and mongodb an application that stores all temperature values by hour in a day.
Temperature values should be shown in a dashboard according the timezone where the sensor is located.
I created a data model following the recommendation for time series data but I don't know how to deal with timezone because mongodb stores dates in UTC so in my data model the object "hours" has static fields for every hour of the day.
// Temperatures by hour in a day.
{
dateStart: ISODate("2016-08-06T00:00:00.000Z"), // This is the start of the day
timeZone: "Europe/Madrid", // We could store the time zone of the sensor.
hours: { // I'm not sure how to deal with these values. Should be UTC hours too?
0: 20
1: 21,
2: 24,
.
.
.
23: 16
}
}
The question is: how can I deal with timezone?
In my local time the start of a day (2016-08-06T00:00:00) is converted to UTC to 2016-08-05T22:00:00.000+02:00.
A first approach could be:
Sensor time zone is 'Europe/Madrid' (CEST, 02:00 diff from UTC)
Get the start of day using 'Europe/Madrid time zone, convert it to UTC and store it in database. Field startDate will be "2016-08-05T22:00:00.000Z"
In order to store a 25 C temperature for an hour: Get local time ('Europe/Madrid'), for example 18h, then convert to UTC. Result is 16h. So hours.16=25.
In this case we have UTC times in star date but the object of hours is not UTC. It is 'Europe/Madrid and I'm not very convinced about this decision.
Any ideas for improving this design?
Your design should work, however your example in 3. should be
{
...
16: 25
...
}
The hours is the offset respect to dateStart. So when displaying you should add 16 hours to the start date which you can display in the timezone that you want.

Calculate time in all countries for fixed time in one of them

I have table with all countries GMT/UTC timezones, I need to see what time is in the rest of the countries when in USA is 11am-3pm
Not on particular date just know the difference in time.
I did my calculation like that I -5 GMT in USA and time is 11am then in Russia for example is +4 GMT.
5+4+11=20pm in Russia when USA is 11am, this works with countries that have + GMT zone but ones that have minus it shows wrong time.
I am working in Excel; please help me with advice on how to do it.
I did it already for the +gmt timezones and yes I have times for cities in big countries too; it was not my question.
How can I find out what time zone is in country with -11gmt when in country with +8gmt is 11am?
Someone know?
E.g. I work with dates like this in Excel. I set type of cell data to date and put
1/1/11 4:30 (+4:30 gmt)
1/1/11 1:00 (+1:00 gmt)
Now I have a date e.g. 1/20/11 11:00 (11 am on imaginary date); all I need to do is
"1/20/11 11:00 AM" - "1/1/11 4:30 AM" = "1/19/00 10:00 AM" at (0 gmt)
10am I don't really care about date in this case just time. I cannot think right now how I gound precise time but it seems somehow work without even putting +8 gmt in there...
Anyway solution should look something like that.
What about countries that have more than one time zone?
11am in the USA....where? West coast (PST) or east coast (EST)?
How do you take into consideration daylight savings time?
There are a lot of things to consider to do time conversions correctly.
I personally wouldn't keep a table with country and hour conversions, but two tables. One with timezones and hours from GMT time. And then another one with city names and timezone mappings. This way instead of converting from USA to Russia, you would be converting from New York to Moscow.
I did do a quick search on timezones in excel, and I found this article. I hope that it helps.

Resources