I need to save time HH:MM in MySQL.
Better option is to save using strtotime PHP function as TIMESTAMP or HH:MM:00 as TIME?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s really depends on how you will be processing the dates. If you prefer to do date calculations in MySQL, then most of it’s functions work with DateTimes (or Times). Alternatively, if you’re processing the dates in PHP most functions rely on timestamps, so they may be the way to go.
Another consideration to take into account is the range of dates you’ll be storing. Timestamps will eventually run out in 2038, whereas MySQL DateTimes will carry on well into the future. I know you’re only storing times, not dates… so this may not concern you.
http://en.wikipedia.org/wiki/Year_2038_problem