Playing with LaunchBar Actions: Converting epoch times to human dates

I’ve been a user of Objective Development’s most excellent utility LaunchBar since 2003 (!), I primarily use it for quickly launching applications (type Cmd-Space, start typing some letters, and hit Return à la Spotlight, but more powerful because it remembers the specific letters you’ve used: I type “ph” to launch Photos.app but “phs” for Photoshop for example) and clipboard history, but it has a ton of other functionality and to be honest I probably should take more advantage of it. 😅

One of the things Objective Development added relatively recently is Actions, basically a way to extend LaunchBar with your own custom code to accomplish various tasks, and it occurred to me that I could probably write up something that I often run into at work: needing to convert an epoch timestamp into a human-readable one.

An epoch timestamp is given as the number of seconds (or milliseconds) since the 1st of January 1970 UTC — for example as I type this the current epoch time is 1739007449 — and they’re quite heavily used in all sorts of computery things, including for things like times on logs entries and so on. The difficulty though is that you can’t just look at it and know what the actual human-readable time is, you need to convert it. There’s a website I’ve used for a while, epochconverter.com, which works well, but it’s an extra few steps, so I decided to scratch this itch and write a LaunchBar Action to do it!

You can download it here, unzip it and double-click the resulting .lbaction file to install it into LaunchBar. If called without any input, it will give the current epoch time in seconds and milliseconds. If given an epoch time as input, it will display the human-readable date and time in your local timezone as well as UTC!

I’ve put the code up on Codeberg if anyone is interested.

Leave a Reply

Your email address will not be published. Required fields are marked *