Change day of the month in a Date to first day (01)

前端 未结 5 862
别那么骄傲
别那么骄傲 2020-11-30 11:10

I want to set the day of month in a Date to start date of current month (01). Now I use the following:

currentDate <- Sys.Date()         


        
5条回答
  •  半阙折子戏
    2020-11-30 11:46

    lubridate's floor_date keeps it a Date

    library(lubridate)
    
    floor_date(Sys.Date(), "month")
    

提交回复
热议问题