ValueError: astimezone() cannot be applied to a naive datetime
来源:互联网 发布:webclient 执行js 编辑:程序博客网 时间:2024/05/22 08:10
python datetime做时区转换,使用astimezone(),提示:
ValueError: astimezone() cannot be applied to a naive datetime
解决办法:
utc = pytz.utctz = pytz.timezone("Asia/Shanghai")
#先把原来时间打上utc标签,然后再时区转化time = datetime.datetime.strptime(time, fmt)origin_time = utc.localize(time)correct_time = origin_time.astimezone(tz)
0 0
- ValueError: astimezone() cannot be applied to a naive datetime
- django cannot be applied to a naive datetime
- cannot be applied to
- ValueError:Cannot assign:A must be a 'B' instance.
- Pymongo - TypeError: index 'xxxx' cannot be applied to Cursor instances
- Binary operator ‘|’ cannot be applied to two ‘UIViewAutoresizing’ operands
- ValueError: A 0.7-series setuptools cannot be installed with distribute.
- Error1Operator '+' cannot be applied to operands of type 'string' and 'method group'
- Swift Compiler Error Binary oprator '+' cannot be applied to operands of type 'UInt16' and 'UInt8'
- Android Studio 那些事| ' ' cannot be applied to '(groovy.lang.Closure)'
- Swift中推送通知设置:Binary operator '|' cannot be applied to two UIUserNotificationType operands 错误解决
- Swift2.0后"|" cannot be applied to two operands问题解决方法
- Android Studio 使用二三事----' ' cannot be applied to '(groovy.lang.Closure)'
- Android Studio 那些事| ' ' cannot be applied to '(groovy.lang.Closure)'
- 【iOS】swift-Binary operator '|' cannot be applied to two UIViewAutoresizing operands
- 【java】遇到错误constructor ListNode in class ListNode cannot be applied to given types;
- ResultCode() in ResultCode cannot be applied to (java.lang.String,java.lang.String)
- Angular4中使用RxJS Observable的scan运算符 Operator '+' cannot be applied to types '{}'异常
- Android WebView 的使用
- MyBatis动态SQL语句
- 钩子函数和回调函数的区别
- Lamda进化史
- Introduction to Mobile Robotics
- ValueError: astimezone() cannot be applied to a naive datetime
- NHibernate 继承映射(第十六篇)
- ARC和MRC下Block的使用注意
- Android:使用drawBitmapMesh方法产生水波(一)
- VoLTE小结
- const修饰类的成员函数
- 计算语言学基础概论
- 计算机控制技术课程配套教材习题解答(第1、2、3章)
- Parameter index out of range (2 > number of parameters, which is 1).