score:1

use timedate function

from datetime import datetime, timedelta

latest_hour = datetime.now() - timedelta(hours = 1)

you can also split them by year, month, day, hour

latest_hour.year
latest_hour.month
latest_hour.day
latest_hour.hour

Related Query

More Query from same tag