Created
September 26, 2025 08:41
-
-
Save thanhyds1998/9a1beb70b5892f2e4257e28b445081c1 to your computer and use it in GitHub Desktop.
Date_time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Load the package | |
library(lubridate) | |
# Choose the right parser | |
ymd("2025-09-25") # works for "YYYY-MM-DD" | |
dmy("25/09/2025") # works for "DD/MM/YYYY" | |
mdy("09-25-2025") # works for "MM-DD-YYYY" | |
# Apply to the dataset | |
M2SGS$Date <- dmy(M2SGS$Date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment