RE: [PHP-WIN] MSSQL Date Format Problem
| From: | David Hollister | Date: | Mon, 16 Sep 2002 18:14:57 +0000 |
| Subject: | RE: [PHP-WIN] MSSQL Date Format Problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-15849@lists.php.net to get a copy of this message | ||
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