Skip to main content

FixDateIt

Category Status' and Links
General
CD/CI
PyPI
Github

Overview

FixDateIt is a Python library designed to intelligently correct and normalize date strings into a standard format. It handles various common date formats, separators, and even attempts to fix common data entry errors.

Key Features

  • Format Normalization: Converts various input date formats (e.g., YMD, DMY) into a consistent output format (defaulting to %Y%m%d).
  • Flexible Separators: Automatically handles different separators like /, -, and ..
  • Heuristic Corrections:
    • Century Guessing: Automatically adds the correct century (1900s or 2000s) for two-digit years.
    • Day/Month Swapping: Detects and fixes cases where day and month might have been swapped (e.g., if month > 12).
    • Out-of-range Day Correction: Can optionally cap days to the maximum valid day for a given month (e.g., setting Feb 30th to Feb 28th/29th).
  • Numeric String Parsing: Handles compact numeric strings (e.g., "20230101" or "010123") by intelligently inserting separators before parsing.
  • Month Name Support: Recognizes three-letter month abbreviations (e.g., "JAN", "FEB").

Basic Usage

from fixdate import FixDate

# Basic conversion
fd = FixDate("01-15-2023", p_in_format="MDY")
print(fd.date_str)  # Output: 20230115

# Fixing swapped day/month
fd = FixDate("31/12/2023", p_in_format="MDY")
print(fd.date_str)  # Output: 20231231

# Handling abbreviations
fd = FixDate("15-JAN-23", p_in_format="DMY")
print(fd.date_str)  # Output: 20230115

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fixdate-2.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fixdate-2.1.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file fixdate-2.1.0.tar.gz.

File metadata

  • Download URL: fixdate-2.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure

File hashes

Hashes for fixdate-2.1.0.tar.gz
Algorithm Hash digest
SHA256 13232f1450b9d67277b4565ea39142e54f9a7da64f303f96a63aa533e911acc1
MD5 77b9605daaea9075ad95b94f544e2ac7
BLAKE2b-256 2805a1c8c2b5e37966b27403f1155be378975c7cc8bbebe046f06dbb0cd85910

See more details on using hashes here.

File details

Details for the file fixdate-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: fixdate-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.11 Linux/6.11.0-1018-azure

File hashes

Hashes for fixdate-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6a02d05092e1a1f15158aa3202c523e954401cc09ce1db086637b61342a913a
MD5 fc36dc9f17feeb90649dfd8f02495e61
BLAKE2b-256 76d43dcbde225336895c690c8367726fe43af5c8969f6c761ab2ab0dad5fb6a5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 files

2.0.1

2 files

2.0.0

2 files

1.13.5

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page