Rounding time inserted?


I wonder if anyone can help me with this. I want to paste the current time, rounded up to full quarters. For example, if the time is 13:12, I want it to paste 13:15 etc. What do I write in the (BTT)@dateformat:???(BTT) field? Or do I have to do anything else?

I THINK this is not possible using date format specifiers because they don't support calculations.

You can do it with a terminal command (using the run terminal command action) like this:

date +"%Y-%m-%d %H:$(( $(date +'%M') / 15 * 15 ))" | sed 's/:0$/:00/' | pbcopy

This will copy the rounded date to your clipboard, you can then add an additional action to paste this.

Wow, that's amazing, thank you!

May I ask two things, sorry to bother:

  1. Is it possible to tell it to always round up after 7 minutes and round down before 7 minutes? For example, if the time is between 11:52–12:06, I want it to write "12", and if it's between 12:07–12:21 I want it to write "12:15"?
  2. Actually, instead of xx:15, xx:30, xx:45 I would like it to write "xx,25", "xx,50", "xx,75". Do you know a way to do that?

Thank you for your brilliant answer!