Hi,
I am new to lubridate
I am taking the function
library (lubridate)
date1<-lubridate:: date ()
date1
[1] "Sun Mar 17 20:17:39 2024"
class (date1)
[1] "character"
I would like to format this "Sun Mar 17 20:17:39 2024" into "Sunday 17-03-2024; 20:20"
I cannot manage it by using ymd_hm () or any other lubridate function
Thanks
You can change the string "Sun Mar 17 20:17:39 2024" into the string "Sunday 17-03-2024; 20:20" in a few steps. The only use of lubridate in my code is to round the value to the nearest 5 minutes. The rounding is my guess at your intention in changing the time from 20:17:39 to 20:20.
Since the final result is a string, you can't do calculations or most plotting functions with it.
If format is specified, remember that some of the format specifications are locale-specific, and you may need to set the LC_TIME category appropriately viaSys.setlocale . This most often affects the use of %a , %A (weekday names), %b , %B (month names) and %p (AM/PM).
I have never used Sys.setlocale, so I can't offer guidance immediately but I'll look into what needs to be done.
library (lubridate)
#> Attaching package: 'lubridate'
#> The following objects are masked from 'package:base':
timestamp()
##------ Fri Mar 22 14:04:22 2024 ------##