In my table I have a dateCreated column in the format of DATETIME.
How do I insert the current datetime when I add the record to the database?
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.
Better use
TIMESTAMPinstead and useCURRENT_TIMESTAMPto get current timestamp.TIMESTAMPshould behave exaclty (or very similar) toDATETIMEso you shouldn’t notice a difference.Furthermore you may set
CURRENT_TIMESTAMPas default for all new entries.