Skip to content

trietsch/alfred-datetime-format-converter

Repository files navigation

Alfred Datetime Format Converter

Fork of alexmerkel/alfred-datetime-format-converter with additional functionality

Alfred workflow for converting between timestamps and formatted datetime strings with ease.

Installation

Download the latest release from the releases page.

Usage

Simply type df followed by:

  • now - current timestamp
  • A UTC unix timestamp (seconds or milliseconds)
  • A formatted datetime string (with or without milliseconds, assumed UTC)
  • ISO 8601 format with milliseconds and Z suffix (e.g., 2026-01-19T08:22:24.709Z)
  • A datetime string with timezone offset (e.g., 2026-02-13 18:00:00+00:00)
  • NEW: now - interval 1 day - time arithmetic with intervals
  • NEW: now + 3 hours or now + 2h - add or subtract time using verbose or Prometheus-style syntax

This will present you with the parsed date in various formats ready to copy to your clipboard.

Examples

df now
df 1364302555
df 1737379200000
df 2013-01-15 19:41:06
df 2026-01-16 10:19:55
df 2026-01-16 10:19:55.000
df 2026-01-19T08:22:24.709Z
df 2026-02-13 18:00:00+00:00
df now - 1 day
df now - interval 3 hours
df now + 2 weeks
df now - 2h
df now + 3w
df 1364302555 - 1 hour
df 2026-01-16 10:19:55 - 2 days
df 2026-01-16 10:19:55 - 30m

Timezone Configuration

You can define your timezone variable in Alfred workflow variables:

  • Name: timezone
  • Value: pytz timezone string (e.g., US/Eastern, Europe/London)

If the variable is not set, UTC is used by default.

New Features in This Fork

  • ISO 8601 with milliseconds: Full support for parsing and outputting ISO 8601 format with milliseconds (e.g., 2026-01-19T08:22:24.709Z)
  • Timezone-offset input: Parse datetime strings with explicit UTC offset (e.g., 2026-02-13 18:00:00+00:00)
  • Millisecond precision: Output formats now include millisecond precision timestamps and formatted strings
  • ISO 8601 timezone offset output: Two additional output formats with +00:00 offset (2026-02-20T13:18:52+00:00 and 2026-02-20T13:18:52.000+00:00)
  • Interval arithmetic: Add or subtract time from dates using natural language or Prometheus-style syntax
    • Verbose: now - 1 day, now - interval 3 hours
    • Prometheus-style: now - 2h, now + 3w, 2026-01-16 10:19:55 - 30m
    • Supported units: s, m, h, d, w (or verbose: seconds, minutes, hours, days, weeks)
  • Millisecond timestamp copy fix: The millisecond timestamp can now be properly copied to clipboard
  • Zero external dependencies: Rewritten to use only Python standard library (no pytz, delorean, etc.)

Development

This project uses uv for Python dependency management and pytest for testing.

Requirements

  • uv
  • Python 3.8+

The workflow itself has zero runtime dependencies (only Python stdlib), but development requires pytest.

Setup

# Install dependencies
uv sync

# Build the workflow
make workflow

# Install to Alfred (requires alfred_preferences environment variable)
make install

Available Commands

  • make sync - Install dependencies with uv
  • make vendor - Vendor dependencies into workflow directory
  • make test - Run the test suite
  • make workflow - Build the .alfredworkflow file
  • make install - Install to your Alfred preferences
  • make clean - Clean build artifacts

Testing

Run tests with:

make test
# or directly with uv
uv run pytest tests/ -v

Tests run automatically in CI before each release.

Note: pytest is a dev dependency only and is not included in the workflow bundle.

Technical Details

This workflow uses only Python's standard library (datetime, timedelta, timezone, re, calendar) with no external dependencies. The workflow is extremely lightweight at ~11KB.

Acknowledgments

This fork is based on the excellent work by:

Uses Alfred Python by Jan Müller (Apache 2.0 License)

License

Copyright (c) 2013 Michael Waterfall, published under the MIT License

About

Alfred workflow for converting between timestamps and formatted datetime strings. Uses modern tooling and has zero dependencies.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors