Skip to main content

A library for manipulating datetime strings.

Project description

Dately Logo

Dately Library: Comprehensive Date and Time Handling in Python

The dately module is a comprehensive library designed for advanced date and time manipulation. It offers extensive capabilities to handle various date and time formats, ensuring compatibility across different systems and data structures. The module provides tools for validating, extracting, and transforming date and time information with a focus on performance and accuracy.

Why Choose Dately?

  • Windows Optimized: Specifically addresses inconsistencies in Python's date formatting on the Windows operating system.
  • Comprehensive Functionalities: Supports date parsing, detection, extraction, and conversion for various input types, including date strings, datetime objects, pandas Series, and NumPy arrays.
  • High Performance: Leverages both high-level Python and low-level C code (via Cython) for efficient operations.

Key Features

  1. Date and Time Format Detection:

    • Automatically detect various date and time formats from strings, ensuring seamless parsing and conversion.
    • Supports a wide range of date formats, including standard and unique custom formats.
  2. Timezone Management:

    • Provides detailed information for specific time zones.
    • Converts time from one time zone to another.
    • Retrieves the current time for specific time zones.
    • Categorizes time zones by country, offset, and daylight saving time observance.
  3. String Manipulation and Validation:

    • Extract specific components (year, month, day, hour, minute, second, timezone) from datetime strings.
    • Validate and replace parts of datetime strings to ensure accuracy and consistency.
    • Strip time and timezone information from datetime strings when needed.
  4. Performance Optimizations:

    • Utilizes Cython to enhance performance for computationally intensive tasks.
    • Interfaces with underlying C code to perform high-speed string operations and date validations.

Solving Windows Date Formatting Issues

A key aspect of this module is addressing inconsistencies in Python's date formatting on the Windows operating system. The module specifically targets the handling of the hyphen-minus (-) in date format specifiers. This flag, used to remove leading zeros from formatted output (e.g., turning '01' into '1' for January), works reliably on Unix-like systems but does not function as intended on Windows.

To solve this problem on Windows, the dately module introduces a workaround using regular expressions. It utilizes a detection function to determine the format string and then examines each date component for leading zeros through an extract_date_component function and a subsequent has_leading_zero check. Depending on the presence of leading zeros, the module adjusts the format string-replacing %m with %-m where applicable-to emulate the behavior expected from the hyphen-minus on Unix-like systems.

This method ensures that users on Windows achieve consistent date formatting, effectively compensating for the lack of native support for the hyphen-minus in date specifiers on this system.

Overall, dately is a powerful utility for anyone needing precise and flexible date and time handling in their applications, making it easier to manage, format, and validate date and time data consistently and efficiently.

Project details


Download files

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

Source Distribution

dately-2.0.4.tar.gz (210.1 kB view details)

Uploaded Source

Built Distribution

dately-2.0.4-py3-none-any.whl (211.5 kB view details)

Uploaded Python 3

File details

Details for the file dately-2.0.4.tar.gz.

File metadata

  • Download URL: dately-2.0.4.tar.gz
  • Upload date:
  • Size: 210.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.5

File hashes

Hashes for dately-2.0.4.tar.gz
Algorithm Hash digest
SHA256 0f4d161546cab93a86280e654d60085970a649a8af9e0ee8bb813d67413f86c7
MD5 491e0d7f4953467dacfa8ab1f9fac5e9
BLAKE2b-256 559ee2566ad224e75c7117176724464f817c9f5ccf6574f63efafb516a7a66e5

See more details on using hashes here.

File details

Details for the file dately-2.0.4-py3-none-any.whl.

File metadata

  • Download URL: dately-2.0.4-py3-none-any.whl
  • Upload date:
  • Size: 211.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.5

File hashes

Hashes for dately-2.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3d7c95b74e08a978943f964a175551556cb259f6691ac447216ec35d607c2d4b
MD5 3bc47e92e8faa0246fbb6c4d0cf85937
BLAKE2b-256 e9d6902a96e3ef72ff3f0a5e9ee6e91b8301d73d364eefed11ae2062aab42a84

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page