Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
datetime snippet
import datetime
date = datetime.datetime(2013, 7, 2, 0, 0)
has_time = date and date.time()
print("** has time: %s" % has_time)
if has_time:
print("** date: %s" % date.strftime('%H-%M-%S'))
else:
print("no time specified")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment