Skip to main content

date converter

Преобразует различные форматы дат к единому

from date_converter.dateconverter import DateConverter

date1 = DateConverter('12 мар 21')

date1  # 12 марта 2021
type(date1)  # <class 'dateconverter.DateConverter'>

date1.day  # 12
date1.month  # март
date1.year  # 2021

# Также возвращает дату в виде объекта класса datetime
date1.date  # 2021-03-12
type(date1.date)  # <class 'datetime.date'>

Сложение дат

from date_converter.dateconverter import DateConverter

date = DateConverter('1 mar 21')  # 1 марта 2021
date += '2m'  # 1 мая 2021
date += 12  # 13 мая 2021
date -= '1y'  # 13 мая 2020

Примеры преобразований

2022-04-12    -> 12 апреля 2022

1 мар. 2001г. -> 1 марта 2001

01.10.2021    -> 1 октября 2021

1\mar 2021    -> 1 марта 2021

2021г. 1 мая  -> 1 мая 2021

2021 1 мая    -> 1 мая 2021

21г 1 мая     -> 1 мая 2021

31г 1 мая     -> 1 мая 2031

32г 1 мая     -> 1 мая 1932

1,мар20       -> 1 марта 2020

2021.01.12    -> 12 января 2021

01.12         -> 1 декабря 2022

14 июля       -> 14 июля 2022

23 JUN        -> 23 июня 2022

32 JaN        -> 1 февраля 2022

При превышении количества дней в месяце осуществляется перенос на следующий

232 авг       -> 20 марта 2022

2021г.111 мая -> 19 августа 2021

441.10.2021   -> 15 декабря 2022

21г 111 мая   -> 19 августа 2021

111,мар20     -> 19 июня 2020

Metadata

Release files for dateconverter 0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dateconverter 0.6
File Size Uploaded
dateconverter-0.6.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dateconverter 0.6
File Interpreter ABI Platform
dateconverter-0.6-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / dateconverter-0.6.tar.gz

Download URL dateconverter-0.6.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
519821239ba842ef6d53268d982ae1fb5bd9a547b5c6b1b9c18c11c940be6562
BLAKE2b-256 checksum
How to use checksums
5fcb95a080bf76a778a63cd8fbfc743877f412e4ee84115379a0ead1ca335f4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release files / dateconverter-0.6-py3-none-any.whl

Download URL dateconverter-0.6-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fa867a95988e5e9a33c11ff727f2f72bd07e2c9b3eada84eb0a0277dfbcdfb8
BLAKE2b-256 checksum
How to use checksums
83ef6662dac7f6e34b31a069bbaef6ddbf039fe8402e8842dc0e07e2bfcb748f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.14

Release history Release notifications | RSS feed

This release

0.6 This release

2 release files

0.5

2 release files

0.4

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page