timrosenberg Posted March 9, 2022 Share Posted March 9, 2022 I would like to perform a simple calculation on a time (i.e. +4h); but, all I can find in the documents are calculations using now as the start time. What I want to do is: 9:00 +4h = 13:00 Is this possible? Link to comment
vitor Posted March 10, 2022 Share Posted March 10, 2022 Welcome @timrosenberg, Processes which allow you to make calculations on time typically require that you be specific with the date. That is to say you wouldn’t do 9:00 + 4h but March 10 2022 at 9:00 + 4h (consider what happens when it goes over to the next day; it has to be represented). If you only want to add hours, you’re looking at simple arithmetic: (9 + 4) % 24. The % is the modulo operator. Doing it on 24 will make it “flip over” according to a 24h clock (example: (17 + 9) % 24 = 2 or “5PM plus 9 hours equals 2AM”). You can try these in Alfred’s main window by starting with = then typing the operation. If you want to use this in a Workflow, you’ll have to be more specific in your request. Right now it’s so broad it approximates an XY problem so there’s yet no way to know what the best answer is. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now