Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Greg Kitchin
31,522 PointsHow dates are displayed depending on location
I've not started the date course for Python yet, so I don't know if it'll be covered, but I'm wanting to know how dates are shown, since different countries have different conventions on how dates are displayed.
I know in the US, dates are shown by month/date/year, while in the UK, we use date/month/year. There's a chance where this could be mistaken for one convention over the other (eg, 1/2/2001 could be 2nd of January 2001, or 1st of February 2001).
So, how are dates displayed in regard to this?
1 Answer
Gianpaul Rachiele
4,844 PointsYou get to choose how they are displayed. There is a function in the datetime library that is called datetime.strftime(fmt). It works by taking a datetime object and returning a string in a format that you specify.