Does PHP strip out the seconds from a SQL Server datetime field?

Does PHP strip out the seconds from a SQL Server datetime field?

am 06.12.2005 18:14:36 von Alex Gemmell

Hello!

I'm using PHP 4.4.1 and pulling out records from a SQL Server database.
I use the mssql extension in PHP to connect to SQL Server. My website
works fine for the most part but I have noticed something odd with the
dates returned from SQL Server.

In my SQL Server table I have many datetime fields. For example I can
clearly see (using Enterprise Manager) the field "fldDateCreated"
contains the datetime "06/12/2005 16:20:35" but oddly when I extract
this field into a PHP variable the variable contains this: "Dec 6 2005
4:20PM".

Annoyingly I lose the seconds and I need the entire date and time. Can
anyone explain why the datetime is getting "converted"? What is doing
it (presumably PHP) and how can I get it to stop?

FYI: I use "mssql_pconnect()" to connect to the SQL Server database and
"mssql_fetch_assoc()" to extract each row.

Thanks for any help offered!

Alex

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Does PHP strip out the seconds from a SQL Server datetime field?

am 07.12.2005 01:54:08 von Fen Lu

------=_Part_1947_23628329.1133916848821
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I think there's nothing to your 'mssql_pconnect()' ~
As far as I known, in Oracle, the 'datetime' is stored as a 13 integer, it'=
s
a Unix timestamp
so you won't lose any microsecond while save the 'datetime'

but I didn't found how to do with your problem~

------=_Part_1947_23628329.1133916848821--

Re: Does PHP strip out the seconds from a SQL Server datetime field?

am 07.12.2005 02:01:27 von Fen Lu

------=_Part_1956_30786383.1133917287379
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Try these for a test, I haven't check it~
$mytime=3Dstrtotime($stime)
date('Y-m-d H:i:s',$mytime);

--
From : Fen lu

------=_Part_1956_30786383.1133917287379--