Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
Python Basic Date and Time Scrip
SUBMITTED BY:
alemotta
DATE:
March 28, 2017, 8:44 p.m.
FORMAT:
Text only
SIZE:
604 Bytes
Raw
Download
Tweet
HITS:
857
Go to comments
Report
Python Basic Date and Time Script
Overview
This script can be used to parse date and time.
Open a blank file and name it for example dateParser.py
Copy and paste the code below (and make sure you understand what it does) into
the file.
dateParser.py
from datetime import datetime
now = datetime.now()
mm = str(now.month)
dd = str(now.day)
yyyy = str(now.year)
hour = str(now.hour)
mi = str(now.minute)
ss = str(now.second)
print mm + "/" + dd + "/" + yyyy + " " + hour + ":" + mi + ":" + ss
Now save and exit the file and run it by:
$ python dateParser.py
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus