3
echo date('d/m/Y H:i:s'); 
//output: 13/12/2012 11:10:57

print_r(getDataArray($dblink, 'select current_timestamp')); 
//output: Array ( [0] => Array ( [computed] => **2012-04-12 11110:05** ) )

When I try to get a "current_timestamp" + php + sql server, I get an error, an incorrect date. Can anyone help me?

  • date convert in mssql config (php.ini) is "off"

that's a problem in locale.conf ? /etc/locale.conf ....

thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Eduardo Stuart
  • 2,869
  • 18
  • 22

2 Answers2

0

The problem can be with the format that datetime columns are returned in.

Try this in your php.ini :

After this line:

;mssql.datetimeconvert = On

Add this line:

mssql.datetimeconvert = Off
Bogdan Burym
  • 5,482
  • 2
  • 27
  • 46
-1

Try:

After connection execute query:

SET DATEFORMAT ymd;

PHP:

odbc_exec($conn, "SET DATEFORMAT ymd");
Bialy7
  • 87
  • 4