Skip to content

date string, datetime, time and timestamp converter in python

License

Notifications You must be signed in to change notification settings

restran/beautiful-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BeautifulTime

https://travis-ci.org/restran/beautiful-time.svg?branch=master https://coveralls.io/repos/github/restran/beautiful-time/badge.svg?branch=master

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

Install

pip install beautiful-time

Usage

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)

About

date string, datetime, time and timestamp converter in python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages