2017-03-21 56 views
0

我有一個data table,其中包含以下格式的日期:8/11/2016 我想將此日期格式更改爲那個:Sunday, September 11, 2016。 有沒有一個快速和骯髒的方法來做到這一點?在R中更改日期格式,包括當天

+2

見'strftime'幫助頁面。你使用data.table的事實並不重要。 – MrFlick

回答

3
#create the variable 

x <- as.Date('08/11/2016','%m/%d/%Y') 

# convert to the desired format 

as.character(x, '%A, %B %d, %Y') 


# more about that here 
# http://www.statmethods.net/input/dates.html