On exporting files I like to have a folder with date/time but I’m trying to find a way to round the time down to the last half hour or quarter hour. So Instead of something like ‘1217’ it would be 1200 or ‘0937’ would be ‘0930’
Is this possible without a bunch of math for each minute possible?
Another solution I found that works specifically with datetime. Change the 15’s to whatever increment you want:
date = datetime.datetime.now()
approx = round(date.minute/15.0) * 15
date = date.replace(minute=0)
date += datetime.timedelta(seconds=approx * 60)
time = date.time()