cloudmesh-common.cloudmesh.common.DateTime

Module Contents

Classes

DateTime

This class provides some simple date time functions so we can use all the

class cloudmesh-common.cloudmesh.common.DateTime.DateTime

Bases: 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

static now()
static natural(time)
static words(time)
static datetime(time)
static humanize(time)
static string(time)
static delta(n)
static utc(time)
static local(time)
utc_to_local(time)
cloudmesh-common.cloudmesh.common.DateTime.start