[R] Convert character date time to R date-time variable.
    Martin Maechler 
    m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
       
    Fri Dec  8 09:09:24 CET 2023
    
    
  
>>>>> Ebert,Timothy Aaron 
>>>>>     on Thu, 7 Dec 2023 16:29:09 +0000 writes:
    > Look at the lubridate package in R.  Regards, Tim
Absolutely *un*needed here !! - as others mention in this
thread.
Very simple with base R:
  > strptime("2020-09-17_00:00:00", format = "%Y-%m-%d_%H:%M:%S")
  [1] "2020-09-17 CEST"
  > 
(in my time zone).
 
    > -----Original Message----- From: R-help
    > <r-help-bounces using r-project.org> On Behalf Of Sorkin, John
    > Sent: Thursday, December 7, 2023 11:22 AM To:
    > r-help using r-project.org (r-help using r-project.org)
    > <r-help using r-project.org> Subject: [R] Convert character date
    > time to R date-time variable.
    > [External Email]
    > Colleagues,
    > I have a matrix of character data that represents date and
    > time. The format of each element of the matrix is
    > "2020-09-17_00:00:00" How can I convert the elements into
    > a valid R date-time constant?
    > Thank you, John
    > John David Sorkin M.D., Ph.D.  Professor of Medicine,
    > University of Maryland School of Medicine;
    > Associate Director for Biostatistics and Informatics,
    > Baltimore VA Medical Center Geriatrics Research,
    > Education, and Clinical Center;
    > PI Biostatistics and Informatics Core, University of
    > Maryland School of Medicine Claude D. Pepper Older
    > Americans Independence Center;
    > Senior Statistician University of Maryland Center for
    > Vascular Research;
    > Division of Gerontology and Paliative Care, 10 North
    > Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524
    > Cell phone 443-418-5382
    > ______________________________________________
    > R-help using r-project.org mailing list -- To UNSUBSCRIBE and
    > more, see https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide
    > http://www.r-project.org/posting-guide.html and provide
    > commented, minimal, self-contained, reproducible code.
    > ______________________________________________
    > R-help using r-project.org mailing list -- To UNSUBSCRIBE and
    > more, see https://stat.ethz.ch/mailman/listinfo/r-help
    > PLEASE do read the posting guide
    > http://www.R-project.org/posting-guide.html and provide
    > commented, minimal, self-contained, reproducible code.
    
    
More information about the R-help
mailing list