From d3a4c8e8f466d5c7b2f5f8c076a48326e5bbaa40 Mon Sep 17 00:00:00 2001 From: Flaper Fesp Date: Mon, 21 Jan 2013 16:31:51 +0100 Subject: UTC ISO8601 from timestamp Taken from glance xattr.py module. This function converts timestamp formated dates into a UTC Iso 8601 date. It is being required in multiple places now (mostly on clients printing dates) in order to make dates human readable. Change-Id: I6f19325a4c2df241a0ef76bd256280a2930d9265 --- openstack/common/timeutils.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openstack') diff --git a/openstack/common/timeutils.py b/openstack/common/timeutils.py index 0f34608..5fd158d 100644 --- a/openstack/common/timeutils.py +++ b/openstack/common/timeutils.py @@ -98,6 +98,11 @@ def utcnow(): return datetime.datetime.utcnow() +def iso8601_from_timestamp(timestamp): + """Returns a iso8601 formated date from timestamp""" + return isotime(datetime.datetime.utcfromtimestamp(timestamp)) + + utcnow.override_time = None -- cgit