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

Ajay

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

commented: Well said +11

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.