R格式化日期
示例
要格式化Dates我们使用format(date,format="%Y-%m-%d")函数无论是POSIXct(从给出的)或(从给出)as.POSIXct()POSIXltas.POSIXlt()
d = as.Date("2016-07-21") # Current Date Time Stamp
format(d,"%a") # Abbreviated Weekday
## [1] "Thu"
format(d,"%A") # Full Weekday
## [1] "Thursday"
format(d,"%b") # Abbreviated Month
## [1] "Jul"
format(d,"%B") # Full Month
## [1] "July"
format(d,"%m") # 00-12 Month Format
## [1] "07"
format(d,"%d") # 00-31 Day Format
## [1] "21"
format(d,"%e") # 0-31 Day Format
## [1] "21"
format(d,"%y") # 00-99 Year
## [1] "16"
format(d,"%Y") # Year with Century
## [1] "2016"有关更多信息,请参见?strptime。
热门推荐
10 分别发的祝福语简短
11 大外甥高考祝福语简短
12 小学毕业校长简短祝福语
13 搞工程发财祝福语简短
14 冬季祝福语男生文案简短
15 同事生子问候祝福语简短
16 退休文案寄语简短祝福语
17 送给自己的祝福语简短
18 简短祝福语毛笔字