How to format time with AM/PM?

Sometimes you might want to format the date / time data as something like ‘18:10:10’, ‘18:10:10 PM’, or ‘06:10:10 PM’.

You can use ‘format’ function in such cases like below in ‘mutate’ command.

format(X4, "%H:%M:%S)

‘18:10:10’

format(X4, "%H:%M:%S %p")

‘18:10:10 PM’

format(X4, "%I:%M:%S %p")

‘06:10:10 PM’