Python Datetime Usage


/ Published in: Python
Save to your folder(s)

For some reason it took me a bit to realize that you had to use datetime.datetime


Copy this code and paste it in your HTML
  1. import datetime
  2.  
  3. # ex: 09-06-12-10-01
  4. print datetime.datetime.now().strftime("%y-%m-%d-%H-%M")

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.