I'd recommend using the lubridate package which you can learn more about at the links below:
If you can provide a reprex (see FAQ below), it'll be easier for people to help you with the specifics: