Friday, March 1, 2019

The Datetime Library

The Datetime Library

  • Use datetime to print the date and time in a nice format.
  • EX:


  • Code to print date in the form of mm/dd/yy
print '%02d/%02d/%04d' %(now.month, now.day, now.year)

print hour:minute:second (hh:mm:ss)
print '%s:%s:%s' % (now.hour, now.minute, now.second)

Print mm/dd/yy hh:mm:ss
print '%02d/%02d/%02d %02d:%02d:%04d' % (now.month, now.day, now.year,now.hour, now.minute, now.second)


What did I learn...

   This was a simple lesson, but it was a really useful lesson. I learned how to print the date and time onto the screen using code.

What I'll be doing tomorrow...

  I will be moving onto another lesson tomorrow and it will be about CONDITIONALS & CONTROL FLOW.


No comments:

Post a Comment