Advertisement
182days

Date Time Statistics

May 10th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #Generates a lot of statistics about the current date and time
  2. #Steve Basford 2015
  3.  
  4. import time
  5. import datetime
  6.  
  7. print ("Time in seconds since the epoch: %s" %time.time())
  8. print ("Current date and time: " , datetime.datetime.now())
  9. print ("Or like this: " ,datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
  10.  
  11.  
  12. print ("Current year: ", datetime.date.today().strftime("%Y"))
  13. print ("Month of year: ", datetime.date.today().strftime("%B"))
  14. print ("Week number of the year: ", datetime.date.today().strftime("%W"))
  15. print ("Weekday of the week: ", datetime.date.today().strftime("%w"))
  16. print ("Day of year: ", datetime.date.today().strftime("%j"))
  17. print ("Day of the month : ", datetime.date.today().strftime("%d"))
  18. print ("Day of week: ", datetime.date.today().strftime("%A"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement