删除时间戳只包括月和日

问题描述 投票:-2回答:3

我在数据框“Job_applications”中有一个名为“rejected_at”的表。格式为:“M / DD / YYYY H:M:S PM / AM”。现在我想创建一个只有“M / DD”的新表。我怎么会这样做?enter image description here

r
3个回答
0
投票

你可以用lubridate来做

library(lubridate)

new_date <- mdy_hms("08/14/2017 09:59:06 PM")

new1 <- paste0(month(new_date),"/",day(new_date))
© www.soinside.com 2019 - 2024. All rights reserved.