Advertisement
clockworkpc

Demo Datetime Module in Python

Jun 17th, 2013
647
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. #!/usr/bin/python
  2. #/home/clockworkpc/bin/demo_datetime_module.py
  3.  
  4. # Released under a GPLv3 Licence by Clockwork PC Monday, 2013-06-17, at 22:39:54
  5. # www.clockworkpc.com.au
  6.  
  7. # You are entitled to the following four freedoms:
  8. # Freedom 0: To run this program for any purpose
  9. # Freedom 1: To study how this program works and change it to make it do what you wish
  10. # Freedom 2: To redistribute copies so you can help your neighbour
  11. # Freedom 3: To distribute copies of your modified version to others
  12.  
  13. import datetime, os
  14.  
  15. # Create time-stamp string for folder and file names
  16. now = datetime.datetime.now()
  17. now_string = str(now.strftime("%Y-%m-%d_%A_%H%M%S"))
  18. now_string_with_text = "The current details for today are... " + now_string
  19.  
  20. #%Y = Year
  21. #%m = Month
  22. #%d = Day
  23. #%A = Day of the week
  24. #%H = Hour
  25. #%M = Minute
  26. #%S = Second
  27.  
  28. print now_string
  29. print now_string_with_text
  30.  
  31. os.system("touch demo_file" + now_string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement