Skip to main content

Get possible string format codes of the given datetime object.

Project description

datedetect

Get possible string format codes of the given datetime object.

Supports Python 3.6+.

>>> import datedetect

>>> datedetect.get_format_codes("1997-11-04 12:00:00.123456+5:30")
['%Y-%m-%d %H:%M:%S.%f%z']

>>> datedetect.get_format_codes(["1997-11-04 12:00:00.123456+5:30"], verbose=True)
# verbose True for display name and count of matches
[{'format': '%Y-%m-%d %H:%M:%S.%f%z', 'display_name': 'yyyy-MM-dd HH:mm:ss.ffffffzzz', 'count': 1}]

>>> datedetect.get_format_codes(["10-10-2019", "10-12-2019", "21-1-2019"], verbose=True)
# first date can be both dd-MM-yyyy, MM-dd-yyyy, d-M-yyyy, M-d-yyyy
# second date be dd-MM-yyyy d-M-yyyy MM-dd-yyyy M-d-yyyy
# third date is d-M-yyyy
[{'format': '%-d-%-m-%Y', 'display_name': 'd-M-yyyy', 'count': 3},
 {'format': '%d-%m-%Y', 'display_name': 'dd-MM-yyyy', 'count': 2},
 {'format': '%m-%d-%Y', 'display_name': 'MM-dd-yyyy', 'count': 2},
 {'format': '%-m-%-d-%Y', 'display_name': 'M-d-yyyy', 'count': 2}]

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

datedetect-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

datedetect-1.0.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file datedetect-1.0.0.tar.gz.

File metadata

  • Download URL: datedetect-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.8

File hashes

Hashes for datedetect-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cca290257280d1e72cbfad20abf81dcaa96c6cb069bf832aa30075fac6c53140
MD5 7d96bd540526438b0ffcd368485383cf
BLAKE2b-256 fda09f967b697277bb81553cec8bb08ac0aff26380ca9a113c1f484d8a52c1e2

See more details on using hashes here.

File details

Details for the file datedetect-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: datedetect-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.8

File hashes

Hashes for datedetect-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1bf7e6bffd0d4246156cf321f6056a970efca33809123859f7f336432b457c4a
MD5 65b18f6fe6fad4eed9897b21d2ccbfee
BLAKE2b-256 bf05cc3bc99b3c86790c30684386188fe1cee225f1c3dce069e2a5a162f231e9

See more details on using hashes here.

Supported by

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