import arrow
utc_now = arrow.utcnow()
utc_now
local_time = utc_now.to('US/Central')
buddy_time = utc_now.to('US/Pacific')
boss_time = utc_now.to('Europe/Prague')
print("My Time: " + local_time.format('hh:mm a'))
print("Buddy Time: " + buddy_time.format('hh:mm a'))
print("Boss Time: " + boss_time.format('hh:mm a'))
My Time: 10:18 am
Buddy Time: 08:18 am
Boss Time: 04:18 pm
previous_time = utc_now.shift(hours=-1, days=-20)
utc_now - previous_time
event_time = arrow.get('2021-03-25 16:00:00', 'YYYY-MM-DD HH:mm:ss')
event_time
event_time = event_time.replace(tzinfo='US/Central')
print("Stream Time US Central: " + event_time.format('MM/DD/YY hh:mm a'))
Stream Time US Central: 03/25/21 04:00 pm
birthday = arrow.get('I was born on July 1989', 'MMMM YYYY')
print(f"What year was I born? {birthday.year}")
What year was I born? 1989
arrow.get(1567900664.152325)
arrow.get(2021, 5, 5)
# How long does my program take.
arrow_start = arrow.utcnow()
divsible_7 = []
# Find all numbers under 10,000 divisible by 7
for number in range(1, 100_000_000):
if number % 7 == 0:
divsible_7.append(number)
print(arrow.utcnow() - arrow_start)
0:00:09.387326