Hello people,

Well The problem that I am facing is:
I have a date in string format like 30 Jun 2009, how can I insert it into MYSQL table as DATE data type?

I created the table and declare data type for Date column as DATE, when I insert 30 Jun 2009 as a value into the table, it becomes 00:00:00. What should I do to avoid this error. Please suggest. Thanks


7 Years
Discussion Span
Last Post by baki100

depending on the language used as the front end to the mysql back end,
php $date=strtotime('string');
asp $date=DateTime.Parse('string');
in sql getdate($date)

don't use those codes look em up, I havent, so there will be errors

sql date format sux, is explained here http://www.tizag.com/sqlTutorial/sqldate.php
hugely sux
personal viewa unix timestamp is easier apologies
other people with less rigid literal minds have little trouble with setting up the processing to run queries on sql date types

Edited by almostbob: n/a

Votes + Comments
Well said

try to convert it as a date in the insert statement by using this function:
str_to_date('30 Jun 2009','%d %b %Y')

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.