:mod:`cloudmesh-common.cloudmesh.common.DateTime` ================================================= .. py:module:: cloudmesh-common.cloudmesh.common.DateTime Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: cloudmesh-common.cloudmesh.common.DateTime.DateTime .. class:: DateTime Bases: :class:`object` This class provides some simple date time functions so we can use all the same format. Here is a simple example start = DateTime.now() stop = DateTime.now() + DateTime.delta(1) print ("START", start) print ("STOP", stop) print("HUMANIZE STOP", DateTime.humanize(stop - start)) print ("LOCAL", DateTime.local(start)) print("UTC", DateTime.utc(start)) print("NATURAL", DateTime.natural(start)) print("WORDS", DateTime.words(start)) print("TIMEZONE", DateTime.timezone) This will result in START 2019-08-03 21:34:14.019147 STOP 2019-08-03 21:34:15.019150 HUMANIZE STOP a second ago LOCAL 2019-08-03 17:34:14 EST UTC 2019-08-03 21:34:14.019147 UTC NATURAL 2019-08-03 21:34:14.019147 UTC WORDS Sat 6 Aug 2019, 21:34:14 UTC TIMEZONE EST .. method:: now() :staticmethod: .. method:: natural(time) :staticmethod: .. method:: words(time) :staticmethod: .. method:: datetime(time) :staticmethod: .. method:: humanize(time) :staticmethod: .. method:: string(time) :staticmethod: .. method:: delta(n) :staticmethod: .. method:: utc(time) :staticmethod: .. method:: local(time) :staticmethod: .. method:: utc_to_local(time) .. data:: start