Handling Multiple Timezones in Python
Vložit
- čas přidán 8. 09. 2024
- Today we learn how to handle multiple timezones in Python using pytz.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine...
💻 The Algorithm Bible Book: www.neuralnine...
👕 Programming Merch: www.neuralnine...
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine...
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/Neu...
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/
These videos are really practical
They represent concepts that you'd have to dig around to gather examples on but instead you wrap them up in good examples
THANK YOU! I was really struggling to do some timezone conversions and couldnt figure out why I was getting such weird results (the minutes were changing too). This method worked for me!
buddy, this is the best tutorial on the TZ and DT objekt in youtube! Thank you for the video! Gret job!
Nicely explained. very clear with examples.
Thank you so much for this.
Thanks dude
DST should be Daylight Saving Time
import datetime as dt
import pytz
time_st ="13:00"
from_zone = pytz.timezone("Etc/GMT")
to_zone = pytz.timezone('Asia/Kolkata')
time_utc = dt.datetime.strptime(time_st, '%H:%M')
local_utc = from_zone.localize(time_utc,is_dst=True)
new_time = local_utc.astimezone(to_zone)
print(time_utc.strftime("%H:%M"))
print(new_time.strftime("%H:%M"))
Output:-
13:00
18:53
Expected output:-
13:00
18:30
please if anyone can help
Cool bruder
thanks video
Trying for the love of all things binary to strip this down to only time. So 2022-04-06 00:29:32.681305+00:00 would become 00:29:32. Any idea?
This might be useful for backend?
this works fro my mac?
hi @neuralnine do you have a course of buiding a crypto bot like arbitrage bot with two exchanges or pancake swap sniping bot ?
greate video.
usefull video
Second comment lol