Jump to content

Display and calculate with current date and time


Recommended Posts

Posted (edited)

I created a workflow to display the current date and time in a configurable format.

Pressing enter will copy to clipboard.

 

screenshot_date.png

 

You can also add and subtract time. Examples:

  • date 3w: today + 3 weeks
  • date -2y: today - 2 years
  • date 2m -5d: today + 2 months - 5 days

View GitHub for more details.

 

Direct Download.

Edited by iEnno
Posted

Doesn´t work for me:

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in - on line 2 April 1, 2013 – 14:39

 

Do you have any ideas?

 

I found this workflow over your (german) RSS feed.

Nice one, i like it! :)

 

Domenic

Posted

Very nice idea, but wouldn’t it be much simpler (not to mention probably both faster and less prone to PHP warnings) to use the POSIX date utility that ships with OS X?

Posted

All these PHP error kind of bug me, because I thought they are due to wrong php.ini settings when using PHP >=5.3. Will fix that as soon as I find a minute.

 

Very nice idea, but wouldn’t it be much simpler (not to mention probably both faster and less prone to PHP warnings) to use the POSIX date utility that ships with OS X?

Thanks for the suggestion. Obviously didn't know about it. Will have a look into.

Posted

Whatever PHP error it gives just export that timezone in the 'date' script filter, just place above the one line of code... like so:

export TZ="America/New_York"
ruby date.rb "{query}"

Thank you!

Now it´s working!

Posted (edited)

I built a new version using kopischke's suggestion which increases speed dramatically.

You should be able to update it via alleyoop. If that won't work, please report back and use the link in the first post of this topic ("Direct Download").

From now on in order to configure the date output you have to use strftime syntax. The Workflow should migrate your current setting automatically. Please report back if there are any problems.

Once again: thanks for all suggestions and error reports.

Edit: the timezone fixes shouldn't be necessary anymore.

Edited by iEnno
  • 1 month later...
Posted

I kinda wanna  make a hotkey that directly shows the date and time in large type, but my attempts end in the script itself being shown – could somebody help me out here? Thanks, much appreciated :)

Posted (edited)

Any chance to combine the same date format customization options there?

 

1. Open the Workflow in Alfred Preferences

2. Double-Click the "Run Script" action

3. Add your format, i.e. date +"%B %d, %Y"

 

The +-sign says "here comes a format", double quotes wrap it and the actual characters with the %-sign appended have a specific meaning.

The possible characters for the format scan be looked up on http://strfti.me/,

Edited by iEnno
Posted

1. Open the Workflow in Alfred Preferences

2. Double-Click the "Run Script" action

3. Add your format, i.e. date +"%B %d, %Y"

 

The +-sign says "here comes a format", double quotes wrap it and the actual characters with the %-sign appended have a specific meaning.

The possible characters for the format scan be looked up on http://strfti.me/,

Thanks a million :)

  • 10 months later...
Posted

Is there any way to make this workflow calculate from a future date/time?  I'd like to be able to enter some date/time in the future and then add/subtract time from that date.  Any way to do this?  Thanks!

Posted

Is there any way to make this workflow calculate from a future date/time?  I'd like to be able to enter some date/time in the future and then add/subtract time from that date.  Any way to do this?  Thanks!

 

Currently there is no way to achieve what you want, but it would surely be useful though. I will try to make some time to implement it, but don't expect it anytime soon. I will let you know when it's ready.

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...