Afficher un message
Vieux 19/02/2008, 10h55   #3
Toby A Inkster
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Different MSSQL output date format from the same PHP script

Alessandro wrote:

> I have a Windows Server 2003 R2 SP2 box where MS SQL 2000 SP4 is
> running.


Using MSSQL, you are really best off specifying your desired date format
as part of the query itself. e.g.

SELECT CONVERT(varchar(20),my_date,20) AS my_date
FROM my_table

will consistently return dates as varchar(20) columns formatted in "YYYY-
MM-DD HH:mm:ss" format. If you don't include the format conversion in the
query itself, then the format you get back can be a bit unpredictable. It
will depend on, amongst other factors: version of PHP, version of FreeDTS,
locale settings and the user name used to log into SQL server.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 20 days, 16:08.]

Bottled Water
http://tobyinkster.co.uk/blog/2008/02/18/bottled-water/
  Réponse avec citation
 
Page generated in 0,05053 seconds with 9 queries