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

PHP CRUD Operations with PHP Creating Records Reading Project Data

Date / Time Format?

The format in this lesson for DATE is TEXT and for TIME is INT.

I am wondering if it would be better to use DATE for the date and TIMESTAMP for the time?

Instructor has set this up using SQLite but I'm following along in MySQL

Ideas Anyone? Thanks!

1 Answer

TIMESTAMP and DATE would normally work but the format provided in this lesson is structured different than the format required by TIMESTAMP and DATE. It is better to stick with the structure provided in this lesson.

  • DATE format needs to be YYYY-MM-DD The format provided in this lesson is DD-MM-YYYY.
  • TIMESTAMP format is super long YYYY-MM-DD HH:MM:SS.
  • TIME would be better than TIMESTAMP and uses only HH:MM:SS. *The format provided in this lesson is 90, 60, 120, 30 etc. *