0

Hello Friends this is my update query.

UPDATE bizz_investor_form set    
  Published_Published='publishedyes',
  Published_Listed_and_Discoverable='listedanddiscoverableno',
  Published_Describe_Start_Date='21-10-2013',
  Describe_end_Date='30-10-2013' 
WHERE user_id =136

When i run that query the date put in database like 0000-00-00 please help any one.

4
  • 1
    What field type is your date field in your database? DATE? Try changing the format to YYYY-MM-DD Commented Oct 21, 2013 at 8:06
  • @FDL i select DATETIME. Commented Oct 21, 2013 at 8:07
  • Maybe it's month-day-year or year-month-day, check the order Commented Oct 21, 2013 at 8:07
  • 1
    In mysql date type datatype fields take value as '2013-10-30' (yyyy-mm-dd) Commented Oct 21, 2013 at 8:09

4 Answers 4

2

Datetime format in mysql is YYYY-MM-DD H:i:s (2013-10-30 11:08:55)

Sign up to request clarification or add additional context in comments.

Comments

0

Change date to like.

$startdate = date("Y-m-d",strtotime('21-10-2013'));
$enddate = date("Y-m-d",strtotime('21-10-2013'));

then after write your query like.

"UPDATE bizz_investor_form set    
  Published_Published='publishedyes',
  Published_Listed_and_Discoverable='listedanddiscoverableno',
  Published_Describe_Start_Date='".$startdate."',
  Describe_end_Date='".$enddate."' 
WHERE user_id =136"

Comments

0

Set field type to DATE or change value to 2013-10-30 00:00:00 (mysql dates format yyyy-mm-dd hh:mm:ss)

Comments

0

MySQL's default DATE field format is YYYY-MM-DD.

You can use DATE_FORMAT

DATE_FORMAT('1997-10-04 00:00:00', '%W %M %Y');

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.