Dates are going to be the death of me yet. I am using PHP v5.6.25
with MSSql 2014.
The column in the tabel is defined as a datetime.
Below is the code I am using and the date is exactly what I need to insert into the column.
$tz_object = new DateTimeZone('EST5EDT');
$datetime = new DateTime();
$wrkDateProcessed = $datetime->format('Y\-d\-m\ h:i:s');
And this is my MS SQl Insert statement:
$sqltxt = "Insert into importIDOCInfo(StoreId,Supplier,IDoc,AmtRcvd,DateProcessed)
Below is the displayed sql statement upon executing:
Insert into importIDOCInfo(StoreId,Supplier,IDoc,AmtRcvd,DateProcessed)values( 1001,'UniMat','Wed, 20 Nov 2019 18:21:05 -0500',1176.47,2019-25-11 07:25:08)
It simply will not do it unless I remove the time and I have to have the time in that format.
I have tried afew different ways and it just spits in my face - all day long.
I have read and read and experiment but it just spits at me.
I have tried to insert with MS SQl Manger as a query and it doesn't like it either - tells me incorrect snytax near 07
I have also used 100 and 101 instead of 21 but it doesn't like it.
Below is what my program displays:
Array ( => Array( => 42000[SQLSTATE] => 42000 => 102[code] => 102 => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near '07'.[message] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near '07'.) )
Can some one please explain to me what I am doing wrong - again...sigh