Advertisement
Peaser

gsre! date format

Nov 2nd, 2014
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. import datetime
  2.  
  3. months = {
  4.     1 : "jan",
  5.     2 : "feb",
  6.     3 : "mar",
  7.     4 : "apr",
  8.     5 : "may",
  9.     6 : "jun",
  10.     7 : "jul",
  11.     8 : "aug",
  12.     9 : "sep",
  13.    10 : "oct",
  14.    11 : "nov",
  15.    12 : "dec"
  16. }
  17.  
  18. now = datetime.datetime.now()
  19.  
  20. day  = "0" + str(now.day) if len(str(now.day)) == 1 else str(now.day)
  21. year = "0" + str(now.year) if len(str(now.year)) == 1 else str(now.year)
  22.  
  23.  
  24. DATE = day + months[now.month] + year
  25.  
  26. print DATE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement