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

Databases Reporting with SQL Date and Time Functions Formatting Dates For Reporting

Capital Y for years in STRFTIME function


I wonder why it should be capital Y for descrdbing year? Why doesn't y work ?

2 Answers

Steven Parker
Steven Parker
229,982 Points

The choice of "Y" for year might seem odd since they use "m" for month and "d" for day β€” but the formats are modeled from other languages where little "y" represents an abbreviated year (just 2 digits) and capital "Y" for the full year.

This version doesn't support the abbreviated version but they kept "Y" to mean the full year.

noteworthy may be the fact that you can include times like sekonds, microseconds etc. this time you could create unique user-hashes, but be wary with these and read into how to securely create hashes first.