Re: Different MSSQL output date format from the same PHP script
- From: Toby A Inkster <usenet200801@xxxxxxxxxxxxxxxxx>
- Date: Tue, 19 Feb 2008 09:55:59 +0000
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/
.
- Follow-Ups:
- Re: Different MSSQL output date format from the same PHP script
- From: Alessandro
- Re: Different MSSQL output date format from the same PHP script
- References:
- Different MSSQL output date format from the same PHP script
- From: Alessandro
- Different MSSQL output date format from the same PHP script
- Prev by Date: Re: How do I pass an array key from a multi-dimensional array to a new array?
- Next by Date: Re: Php form for emailing to you from the web
- Previous by thread: Re: Different MSSQL output date format from the same PHP script
- Next by thread: Re: Different MSSQL output date format from the same PHP script
- Index(es):
Relevant Pages
|