sql - How do you pass a string value in PHP into a sqlsrv() datetime value? -


i have 3 form values concatenate create date of birth:

$b_dob = new datetime($b_dob3."-".$b_dob1."-".$b_dob2); 

and i'm trying insert (datetime) value (which part of array):

$insertinapp[ 'b_dob' ] = date_format($b_dob, 'y-m-d h:i:s'); 

and keep getting error:

the conversion of varchar data type datetime data type resulted in out-of-range value.

am adding characters new datetime string make invalid date_format, or issue using date_format?

try

$b_dob = $b_dob3."-".$b_dob1."-".$b_dob2;     $insertinapp[ 'b_dob' ] = date('y-m-d h:i:s', strtotime($b_dob)); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -