home / skills / christopheryeo / claude-skills / reverse-date

reverse-date skill

/reverse-date

This skill converts dates from many formats to ISO-8601, enabling consistent data processing and machine-readable outputs.

npx playbooks add skill christopheryeo/claude-skills --skill reverse-date

Review the files below or copy the command above to add this skill to your agents.

Files (2)
skill.md
1.8 KB
---
name: reverse-date
description: Convert dates from various formats (like "21 Oct 2025", "October 21, 2025", "21/10/2025") to ISO format (YYYY-MM-DD). Use when users need to standardize date formats, convert human-readable dates to machine-readable formats, or reformat dates for data processing.
---

# Date Converter

## Overview

Convert dates from various human-readable formats into standardized ISO format (YYYY-MM-DD). This skill handles flexible date input parsing and provides consistent, machine-readable output.

## Usage

Use the `convert_date.py` script to convert any date string to YYYY-MM-DD format:

```bash
python scripts/convert_date.py "21 Oct 2025"
# Output: 2025-10-21
```

### Supported Input Formats

The script accepts a wide variety of date formats, including:

- **Month-day-year**: "21 Oct 2025", "October 21, 2025", "Oct 21, 2025"
- **Slash-separated**: "21/10/2025", "10/21/2025"
- **Dash-separated**: "21-10-2025", "2025-10-21"
- **Other common formats**: Most standard date representations

### Examples

```bash
# Human-readable format
python scripts/convert_date.py "21 Oct 2025"
# → 2025-10-21

# Full month name
python scripts/convert_date.py "October 21, 2025"
# → 2025-10-21

# Slash format
python scripts/convert_date.py "21/10/2025"
# → 2025-10-21

# Already in ISO format
python scripts/convert_date.py "2025-10-21"
# → 2025-10-21
```

### Error Handling

If the date string cannot be parsed, the script returns an error message:

```bash
python scripts/convert_date.py "invalid date"
# Error: Unable to parse date: 'invalid date'. Error: Unknown string format: invalid date
```

## Implementation Details

The script uses Python's `dateutil.parser` library for flexible date parsing, which handles many common date formats automatically. The output is always in ISO 8601 format (YYYY-MM-DD).
```

Overview

This skill converts dates from many human-readable formats into standardized ISO format (YYYY-MM-DD). It provides a reliable way to normalize dates for data processing, reporting, and integrations. The converter focuses on flexible parsing and predictable machine-readable output.

How this skill works

The skill parses input date strings using a robust date parser that recognizes month names, numeric day/month orders, slashes, dashes, and common variations. Once parsed, it formats the resulting date as ISO 8601 (YYYY-MM-DD). If parsing fails, the skill returns a clear error explaining the problem.

When to use it

  • Standardizing dates before importing data into databases or spreadsheets
  • Converting user-entered dates for APIs and automation workflows
  • Normalizing mixed-format historical or log timestamps
  • Preparing date fields for sorting, filtering, or analytics
  • Cleaning datasets that include both textual and numeric date formats

Best practices

  • Prefer unambiguous input when possible (e.g., include the month name) to avoid locale ambiguities
  • Validate output after conversion when processing large batches to catch edge cases
  • Handle parse errors gracefully by logging the original string and the error message
  • Normalize timezone or time fields separately; this skill focuses on calendar date normalization
  • Use ISO output directly in downstream systems to ensure consistent behavior

Example use cases

  • Convert '21 Oct 2025' or 'October 21, 2025' to '2025-10-21' for CSV imports
  • Normalize mixed inputs like '21/10/2025' and '10/21/2025' before merging datasets
  • Transform user-submitted dates into ISO for API payloads
  • Clean log files where dates appear in different human formats
  • Validate and reformat date columns during ETL processes

FAQ

What formats does the converter support?

It handles month names, numeric day/month/year with slashes or dashes, ISO inputs, and most common human-readable date styles.

What happens if a date cannot be parsed?

The skill returns a clear error message specifying the original string and the parser error so you can handle or log the failure.