Perhaps more to the point also look at this:

http://stackoverflow.com/questions/969285/how-do-i-translate-a-iso-8601-datetime-string-into-a-python-datetime-object?lq=1


-----Original Message-----
From: spacewalk-list-boun...@redhat.com 
[mailto:spacewalk-list-boun...@redhat.com] On Behalf Of Andy Ingham
Sent: Thursday, February 06, 2014 1:14 PM
To: spacewalk-list@redhat.com
Subject: [Spacewalk-list] timestamps and the spacecmd API

Hello all!

I need to compare the "completed_date" from the listSystemEvents method 
(published at 
http://www.spacewalkproject.org/documentation/api/1.9/handlers/SystemHandle
r.html#listSystems ) to the current time (when my python script runs).

The 'completed_date' is returned from the API in ISO8601 format, e.g.:
20131230T23:00:24

I'm grabbing the current timestamp via datetime.datetime.now(), which returns a 
format like: 2014-02-06 13:05:47.583122



Has anyone got python code that compares two timestamps for use with the 
spacewalk API?  (Ultimately, I want to create a conditional that says, "if the 
event completed less than X hours ago, do Y")

TIA!


Andy

Andy Ingham
IT Infrastructure
Fuqua School of Business
Duke University







_______________________________________________
Spacewalk-list mailing list
Spacewalk-list@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to