Hello. I am not sure if this hint might be useful, but I share it anyway: what about using the as.POSIXct command?
as.POSIXct(mydate, format="%d-%m-%Y) or as.POSIXct(mydate, format="%d/%m/%Y) Hope this helps Stefano (oo) --oOO--( )--OOo---------------- Stefano Sofia PhD Civil Protection - Marche Region Meteo Section Snow Section Via del Colle Ameno 5 60126 Torrette di Ancona, Ancona Uff: 071 806 7743 E-mail: stefano.so...@regione.marche.it ---Oo---------oO---------------- Date: Sat, 2 Nov 2019 21:25:09 -0500 From: <reichm...@sbcglobal.net> To: <r-help@r-project.org> Subject: [R] transforming dates Message-ID: <000001d591ed$eae94350$c0bbc9f0$@sbcglobal.net> Content-Type: text/plain; charset="utf-8" R-Help Forum I have a data set that contains a date field but the dates are in two formats 11/7/2016 dd/mm/yyyy 14-07-16 dd-mm-yy How would I go about correcting this problem. Should I separate the dates, format them , and then recombine? Sincerely Jeff Reichman (314) 457-1966 [[alternative HTML version deleted]] ________________________________ AVVISO IMPORTANTE: Questo messaggio di posta elettronica può contenere informazioni confidenziali, pertanto è destinato solo a persone autorizzate alla ricezione. I messaggi di posta elettronica per i client di Regione Marche possono contenere informazioni confidenziali e con privilegi legali. Se non si è il destinatario specificato, non leggere, copiare, inoltrare o archiviare questo messaggio. Se si è ricevuto questo messaggio per errore, inoltrarlo al mittente ed eliminarlo completamente dal sistema del proprio computer. Ai sensi dell’art. 6 della DGR n. 1394/2008 si segnala che, in caso di necessità ed urgenza, la risposta al presente messaggio di posta elettronica può essere visionata da persone estranee al destinatario. IMPORTANT NOTICE: This e-mail message is intended to be received only by persons entitled to receive the confidential information it may contain. E-mail messages to clients of Regione Marche may contain information that is confidential and legally privileged. Please do not read, copy, forward, or store this message unless you are an intended recipient of it. If you have received this message in error, please forward it to the sender and delete it completely from your computer system. -- Questo messaggio stato analizzato da Libra ESVA ed risultato non infetto. This message was scanned by Libra ESVA and is believed to be clean. ______________________________________________ R-help@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.