Hi friends...
I have a variable $datetime= 140811 060632.
Here 140811 represents date in ddmmyy format and 060632 represents time 06:06:32 and both are in string type.
I have a column name "DtTime" in MSSQL of type "Datetime" stamp.
Now when i try to insert my variable $datetime in above column of database it returns an "out of memory" error which means I think I have to convert my string to "datetime" stamp type first and then try to insert.
I don't know how I can convert string to datetime type so that it inserts in column of "datetime" stamp type.
Please help...
Thanks in advance.....

Try this:

$datetime= "140811 060632";
$dt = str_replace(' ','',$datetime);
$a = str_split($dt,2);
$b = $a[2] .'-'. $a[1] .'-'. $a[0] .' '. $a[3] .':'. $a[4] .':'. $a[5];
echo date('Y-m-d H:i:s', strtotime($b)); # 2011-08-14 06:06:32