as posixct get hour code example Example: as posixct get hour format(as.POSIXct("2000-02-29 09:22:05"), "%H")