python utc时间转北京时间
作者:互联网
t = "2021-04-08T01:00:00" def format_time(self,india_time_str, india_format='%Y-%m-%dT%H:%M:%S'): india_dt = datetime.datetime.strptime(india_time_str, india_format) local_dt = india_dt + datetime.timedelta(hours=8) local_format = "%Y-%m-%d %H:%M:%S" time_str = local_dt.strftime(local_format) return time_str
标签:-%,utc,format,python,india,时间,time,dt,local 来源: https://blog.51cto.com/haoyonghui/2692236