datetime
Have you been seeing deprecation warnings from datetime around your UTC time calls? That's important since most earth science data are in UTC! This week learn how to fix it in the return of MetPyMondays!
code:python
from datetime import datetime,timedelta,timezone
datetime(1970,1,1,18,0,tzinfo=timezone.utc)
sixteen_hundred_local=datetime(2024,10,28,16,tzinfo=timezone(timedelta(hours=-5)))
sixteen_hundred_local.astimezone(timezone.utc)
Learn how to manage time zones in Python without relying on deprecated libraries! In this episode of MetPy Mondays, we dive into Python's zoneinfo module to set time zones, convert times across zones, and handle tricky daylight saving transitions. Discover essential time zone tricks for your data workflows, including understanding ambiguous times and performing accurate time arithmetic across zones. Whether you're working with logs, event scheduling, or analyzing time series data, this guide will enhance your Python skills in handling time zones like a pro! Datetimes and Timedeltas — NumPy Manual
numpy.timedelta64で時刻データをチェック - Qiita
Tutorials
See also