Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
12
Task/Date-manipulation/Python/date-manipulation.py
Normal file
12
Task/Date-manipulation/Python/date-manipulation.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import datetime
|
||||
|
||||
def mt():
|
||||
datime1="March 7 2009 7:30pm EST"
|
||||
formatting = "%B %d %Y %I:%M%p "
|
||||
datime2 = datime1[:-3] # format can't handle "EST" for some reason
|
||||
tdelta = datetime.timedelta(hours=12) # twelve hours..
|
||||
s3 = datetime.datetime.strptime(datime2, formatting)
|
||||
datime2 = s3+tdelta
|
||||
print datime2.strftime("%B %d %Y %I:%M%p %Z") + datime1[-3:]
|
||||
|
||||
mt()
|
||||
Loading…
Add table
Add a link
Reference in a new issue