Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #/home/clockworkpc/bin/demo_datetime_module.py
- # Released under a GPLv3 Licence by Clockwork PC Monday, 2013-06-17, at 22:39:54
- # www.clockworkpc.com.au
- # You are entitled to the following four freedoms:
- # Freedom 0: To run this program for any purpose
- # Freedom 1: To study how this program works and change it to make it do what you wish
- # Freedom 2: To redistribute copies so you can help your neighbour
- # Freedom 3: To distribute copies of your modified version to others
- import datetime, os
- # Create time-stamp string for folder and file names
- now = datetime.datetime.now()
- now_string = str(now.strftime("%Y-%m-%d_%A_%H%M%S"))
- now_string_with_text = "The current details for today are... " + now_string
- #%Y = Year
- #%m = Month
- #%d = Day
- #%A = Day of the week
- #%H = Hour
- #%M = Minute
- #%S = Second
- print now_string
- print now_string_with_text
- os.system("touch demo_file" + now_string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement