Timestamp

An Alfred Workflow


Short Description

Get current unix timestamp or convert a string to a timestamp or a timestamp to a datetime.

Last Updated

06 Oct 2016

Compatibility

Yosemite
(10.10)
Mavericks
(10.9)
Mountain Lion
(10.8)
Lion
(10.7)
Snow Leopard
(10.6)
Yes Yes Yes Yes Yes
 

Version

1.0
 

Bundle ID

com.jousch.alfred.timestamp
 

Author

OVERVIEW

This workflow performs the following functions: - Get current timestamp. - Convert a timestamp to DATETIME format. - Convert a string date to timestamp.

USAGE

Use the 'ts' command followed by your conversion request. You can use a unix timestamp or any string that could be parsed by the php function strtotime (http://php.net/manual/en/function.strtotime.php)

Examples

"ts" Returns current timestamp in seconds.

"ts 1363975708" Returns "2013-03-22 02:08:28"

"ts tomorrow" "ts 1 year ago" "ts next thursday" Returns timestamp for the given day at 12 am

INFO ABOUT PHP TIMEZONE:

This workflow uses PHP, so it will return whatever default timezone is set on your php.ini. PHP errors are suppressed here due to a tendency for Macs to produce a warning that you need to set your PHP default timezone.

If you are getting results not in your timezone, you should set the date.timezone in your Mac's php.ini file, usually found at /etc/php.ini.default.

If you use, for example PHP installed via homebrew, you normally will find your php.ini at /usr/local/etc/php//php.ini). You also can try php -i | grep "Loaded Configuration File" to get the path to your active/loaded PHP configuration file.

My blog post about the workflow inclusive introduction video