/whiterose

A python toolkit to work with date time functions

Primary LanguagePythonMIT LicenseMIT

Whiterose - A Python DateTime Toolkit

"The concept of waiting bewilders me. There are always deadlines. There are always ticking clocks. That's why you must manage your time"
Whiterose - Mr. Robot

Install

Until the test suite is uploaded, the toolkit can be installed from TestPyPi.

pip install -i https://test.pypi.org/simple/ whiterose==0.9.2

Toolkit

localtime()

>>> localtime()
time.struct_time(...)

today()

>>> today('UTC')
'2020/12/18T22:24:58'
>>> today('MX')
'2020/12/18T16:24:58'

Epoch, The Unix Timestamps Manager

Epoch.dump()
>>> Epoch.dump(2020, 12, 18, 16)
1608328800.0
Epoch.load()
>>> tms = Epoch.load(epoch)
'2020-12-18 16:24:58.109826'
>>> type(tms)
"<class 'datetime.datetime'>"
Epoch.now()
>>> Epoch.now()
1608330298.110156
Epoch.strfload()
>>> Epoch.strfload(1608330298.110156, datetime=True)
'2020/12/18T16:24:58'
>>> Epoch.strfload(1608330298.110156, datetime=False)
'2020/12/18'