Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python Dates and Times in Python Where on Earth do Timezones Make Sense? Introduction to Timezones

spencer tintorri
spencer tintorri
6,184 Points

For mumbai, is there an advantage to using hours=5, minutes=30 instead of just using hours=5.5 ?

See above. Thank you.

1 Answer

Jeff Muday
Jeff Muday
Treehouse Moderator 26,896 Points

That is an excellent question-- you are really paying close attention to Kenneth's teaching!

Even though Datetime objects in representation __repr__ are made up of integers rounded to the nearest microsecond (e.g. 10^-9). According to the official documentation, it should not be a problem to use a float for hours.


All arguments are optional and default to 0. Arguments may be integers or floats, and may be positive or negative.


If you are a Python geek like me, you may want to look over the code. There are a number of // (floor division) operators involved in conversions. This means there are quite a bit of floating point operations taking place internally that require conversion back to integers.


Good luck with your Python journey!