Jump to content

Time and Timezone workflow


Recommended Posts

I'm trying to see if ther eis a way that I can use Workflows to automatically paste time zone differences. 

Example: trigger using ;time and a text field pops up where I enter a time, let's say 2:00pm and then when I hit enter, in the Clipboard is 2:00pm/12:30pm EST

 

My timezone has an extra 30mins and it screws up a lot of people, so if I could do something like this to easily post the time conversion based on the time I enter, that would be awesome, just not sure how I would make it happen. 

Link to comment

@MacDaddy This shell command could be a good starting point, it takes an input (2:00pm) and outputs it to the timezone set by the TZ variable (3:00PM EDT):

TZ="America/New_York" date -jf "%s" "$(date -jf "%I:%M%p" "$1" +"%s")" +"%I:%M%p %Z"

 

This uses the built-in date command twice to convert a time ($1) from your local timezone to the timezone specified by the TZ variable (America/New_York).

 

For the use case you've outlined, you can use that command in a Run Script object. Input a time using the Keyword object and output the Run Script to a Copy to Clipboard Output. Make sure to set the TZ variable to the actual timezone you need.

 

Feel free to drop any other questions you may have, including clarifications on how the date command works if you need to modify it.

Link to comment

@MacDaddy I created a quick Workflow that should do what you want. You can set the source and target timezone codes in configuration, and trigger it in one of three ways: 1) keyword (default tzz), 2) Universal Action (after selecting text with a time), or 3) via snippet (which you can set to ;time as you describe).

Enter will copy to clipboard/paste. 

Link to comment
On 8/7/2024 at 6:47 AM, giovanni said:

@MacDaddy I created a quick Workflow that should do what you want. You can set the source and target timezone codes in configuration, and trigger it in one of three ways: 1) keyword (default tzz), 2) Universal Action (after selecting text with a time), or 3) via snippet (which you can set to ;time as you describe).

Enter will copy to clipboard/paste. 

 

Thank you so much! I'll give this a try at work tomorrow when I have my Alfred. 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...