RE: [PHP-WIN] MSSQL Date Format Problem
| From: | Calum Scott | Date: | Mon, 16 Sep 2002 19:53:57 +0000 |
| Subject: | RE: [PHP-WIN] MSSQL Date Format Problem | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-15852@lists.php.net to get a copy of this message | ||
Thanks to all who replied.
I found the answer to this one on the microsoft support site.
The problem lies in the way that IIS running on Windows 2000 Advanced Server
handles regional settings.
The full text can be found here...
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q306044
...I know it says its about ASP but the principle is the same. If anyone is
implementing this make sure that you use option 2 for the registry keys and
make sure you read all of the text where it explains about what option 2
means! I didn't and ended up going round in circles for hours!!!
Cheers
Calum
-----Original Message-----
From: David Hollister [mailto:Dhollister@mke.catalystwms.com]
Sent: 16 September 2002 19:15
To: 'Calum Scott'; php-windows@lists.php.net
Subject: RE: [PHP-WIN] MSSQL Date Format Problem
Questions I have are:
1) Which date datatype is the date field? Custom or datetime?
2) What format is returned when you select the date column in query analyzer
from each machine (assuming query analyzer is diff version on each client)?
3) When you say "regional options" do you mean you have already checked the
TIME display tab in control panel \ regional options ?
4) Are you setting any connection options after you make the db session?
Otherwise, just utilize PHP to format the return to a common format.
Throwing in a couple lines to format shouldn't take very long; it's not the
same as recoding. And double check MS's site for SQL version differences
and session options in relation to datetime. SQL 7 doesn't have too much in
the way of formatting the date per session, but 2000 might.
-----Original Message-----
From: Calum Scott [mailto:Calum@inva-systems.fsnet.co.uk]
Sent: Saturday, September 14, 2002 9:17 AM
To: php-windows@lists.php.net
Subject: [PHP-WIN] MSSQL Date Format Problem
Hi,
I have a small problem with the formats of dates on two separate machines
running the same code!
Machine One
-----------
Windows 2000 Pro
IIS 5
PHP 4.1.2
MS SQL Server 7
Machine Two
-----------
Windows 2000 Advanced Server
IIS 5
PHP 4.1.2
MS SQL Server 2000
Code
----
<?
$cn = mssql_connect("SRVName","User","Password");
mssql_select_db("DBName");
$sqlq = "select DateField from Table";
$rs = mssql_query($sqlq);
$row = mssql_fetch_row($rs);
echo $row[0];
?>
Results Machine One
-------------------
14 Sep 2002 0:00
Results Machine Two
-------------------
Sep 14 2002 12:00AM
I have tried setting all the "Regional Settings" locales and languages to
British English on both machines but it seems like I've missed one on
Machine Two!
Incidentally, inserting a value into the databases on both machines works
presenting the date as "14/9/2002", it is just when returning a recordset to
PHP via the select statement that the difference occurs.
I'm at a total loss! It must be something to do with PHP, IIS or SQL Server
but I can't find what, if anyone has any ideas I'd be most grateful, however
recoding is not an option as the system is pretty big!
TIA
CAS
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php