Skip to main content

date string, datetime, time and timestamp converter

Project description

BeautifulTime is a python package for converting date string, datetime, time and timestamp.


pip install beautiful_time


import BeautifulTime

date_str = '2016-10-30 12:30:30'
dt = BeautifulTime.str2datetime(date_str)
# with a custom format
dt = BeautifulTime.str2datetime(date_str, format='%Y-%m-%d %H:%M:%S')
t = BeautifulTime.str2time(date_str)
ts = BeautifulTime.str2timestamp(date_str)

dt = BeautifulTime.str2datetime(date_str)
t = BeautifulTime.str2time(date_str)
ts = BeautifulTime.str2timestamp(date_str)

s = BeautifulTime.datetime2str(dt)
t = BeautifulTime.datetime2time(dt)
ts = BeautifulTime.datetime2timestamp(dt)

s = BeautifulTime.time2str(t)
dt = BeautifulTime.time2datetime(t)
ts = BeautifulTime.time2timestamp(t)

dt = BeautifulTime.timestamp2datetime(ts)
t = BeautifulTime.timestamp2time(ts)
s = BeautifulTime.timestamp2str(ts)

Project details

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
beautiful-time-0.2.tar.gz (2.0 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page