AnsweredAssumed Answered

Time not entered when inserting record using webservice

Question asked by vishan on Jun 30, 2014
Latest reply on Jul 21, 2016 by Craig Mariner

I am using Sugarcrm Pro and MSSQL 2008 R2 database on windows server.
When I insert record using webservice to the CRM with datetime values it does not insert the correct date time value.

If I pass just the date it inserts fine, but when I pass both date time it enters the default date of 1.1.1970 into the database. The database field is datetime.

This is what i am trying:

        $depart_date = new DateTime($datetimetotinsert);
        $departure_date = $depart_date->format('Y-m-d H:i');

This works fine:
        $depart_date = new DateTime($datetimetoinsert);
        $departure_date = $depart_date->format('Y-m-d');

Please help me as I am stuck here and need the time also.