[英]Converting 12 hour format to 24 hour without timezone in R
I've tried using strptime and as.Date to convert a 12 hour format to 24 hour but I'm getting NA for both. 我已经尝试使用strptime和as.Date将12小时格式转换为24小时,但是我都无法使用。 I'm not sure where the issue is
我不确定问题出在哪里
as.Date("3/23/2017 3:10:36 PM", format="%m/%d/%y %I:%M:%S %p")
strptime("3/23/2017 3:10:36 PM","%m/%d/%y %I:%M:%S %p")
Any pointers to help me out? 有什么指针可以帮助我吗? Preferably without a timezone appended
最好不附加时区
Simply use 只需使用
x <- strptime("3/23/2017 3:10:36 PM", format="%m/%d/%Y %I:%M:%S %p")
(With capital %Y for 4-digit year) And then (使用%Y表示4位数字的年份)然后
format(x, "%Y-%m-%d %H:%M:%S")
To get a 24-h format character string without time zone. 获取不带时区的24小时格式的字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.