A handy python function to parse and convert to and between datetime.datetime, int, and string objects
Project description
Date Converter
A handy date parser and converter that handles timestamps, strings, and datetime.date.
Convert from any date to another with a single function!
Date converter will make your naive dates timezone aware and uniformly convert them to UTC for your convenience!
Basic Use
from date_converter import date_to
some_date = "2001-09-11 17:20 EDT"
print(date_to(some_date, str))
print(date_to(some_date, int))
print(date_to(some_date, "datetime"))
Out:
2001-09-11T21:20:00+00:00
1000243200
2001-09-11 21:20:00+00:00
Accepted Inputs
from datetime import datetime
accepted_object_inputs = int | str | datetime.date
accepted_string_inputs = [
"str", "string",
"int", "timestamp", "epoch", "unix", "float",
"datetime.date", "datetime", "date",
]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
date_to-1.0a1.tar.gz
(11.5 kB
view hashes)