【发布时间】:2017-06-14 09:12:05
【问题描述】:
我需要转换一个字符串如:
"19480804 14:00"
到如下格式的日期:
"Aug 4th, 1948 2 PM"
【问题讨论】:
标签: r date formatting
我需要转换一个字符串如:
"19480804 14:00"
到如下格式的日期:
"Aug 4th, 1948 2 PM"
【问题讨论】:
标签: r date formatting
所有信息:https://www.stat.berkeley.edu/~s133/dates.html
你必须把字符串改成日期格式,例如:
date <-("19480804 14:00")
x <- strptime(date,"%Y%m%d %H:%M")
输出:
[1] "1948-08-04 14:00:00 CEST"
另外:
format(x, format="%b %d, %Y %I %p")
和输出:
"Aug 04, 1948 02 PM"
【讨论】: