xZachtmx
June 17th, 2009, 12:20 AM
ok i want to get the time in this type of format from my computer
12:00
but i dont know how to do that in python...?
unutbu
June 17th, 2009, 12:27 AM
#!/usr/bin/env python
import time
# Two-digit hour in 24-hour format
print(time.strftime('%H:%M'))
# Or you can use the datetime module
import datetime
print(datetime.datetime.now().strftime('%H:%M'))
See http://au2.php.net/strftime for a synopsis of valid codes you can use with strftime.
xZachtmx
June 17th, 2009, 12:34 AM
thanks. Im making a little animated desktop alarm clock widget so this is kinda important :p
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.