Before using PHP 5.2.x because it is already configured, so the read datetime format output is similar: 2008/12/12, after upgrading the system to read data as a datetime data object, search the site found the following:
MSSQL defaults to the system time format output, you can adjust the system's time format to solve the program is of course more flexible, convert (char,date,n) output of the various styles
SELECT convert (char, your date field, as date2 from table)
n Date style 0 2 2005 9:06am1 04/02/052 05.04.023 02/04/054 02.04.055 02-04-056 02 04 057 Geneva, 058 09:06:189 2 2005 9:06:18:857AM10 04-02-0511 05/04/0212 05040213 02 04 2005 09:06:18:85714 09:06:18:85720 200 5-04-02 09:06:1821 2005-04-02 09:06:18.85722 04/02/05 9:06:18 AM23 2005-04-0224 09:06:1825 2005-04-02 09:06:18.857100 04 2 2005 9:06am101 04/02/2005102 2005.04.02103 02/04/2005104 02.04.2005105 02-04-2005106 02 04 2005107 04 02, 2005108 09:06:1 8109 2 2005 9:06:18:857am110 04-02-2005111 2005/04/02112 20050402113 02 04 2005 09:06:18:857114 09:06:18:857120 2005-04 -02 09:06:18121 2005-04-02 09:06:18.857126 2005-04-02t09:06:18.857
Modify the Configuration method: Php from MSSQL read out the database problem, if the server php. ini file is not configured, PHP from MSSQL read out the time format is "20,081 months 27 17:07", rather than everyone familiar 2008-11-27 17:07 format! The solution is as follows:1, modify the php.ini file, find the php.ini file, will MSSQL. Datetimeconvert set to OFF, and remove the beginning of the '; '2, if there is no way to modify PHP. INI file, you can add a sentence in your PHP configuration (analogy database connection file) file: Ini_set // sets the database format.
PHP format problem when reading MSSQL data