Re: MS-SQL date format problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Based on your previous e-mail you are using PHP 4.3.1 on Win32. If that is
the case mssql.datetimeconvert = 0 should produce YYYY-MM-DD HH:MM:SS for
dates. Another solution is to use CONVERT on your datetime fields in your
SELECT statement.

-- bob

On Tue, 13 May 2003, Peter Misun wrote:

>
> code is:
>
> <?php
>
> ini_set( 'mssql.datetimeconvert', 0 );
> $user="user";
> $password="bla";
> $connection_id=mssql_connect("Miranda",$user,$password);
> mssql_select_db("MStepIS",$connection_id);
> $query="select * from Employee where IDEmployee=34";
> $result=mssql_query($query,$connection_id);
>
> echo "Output:<br>\n";
> while ($rown=mssql_fetch_array($result)) {
>  echo "Date=".$rown['DateOfBirth']."<br>\n";
> }
>
> ?>
>
>
> and output is:
> - on server with non english regional settings:
>
> Output:
> Date=22 XII 1975 0:00
>
> - on server with english regional settings:
>
> Output:
> Date=Dec 22 1975 0:00
>
>
> i'm going mad about that ...
>
> 5o
>
>
> Robert Twitty wrote:
>
> > Can you provide the code which is not working?
> >
> > -- bob
> >
> > On Tue, 13 May 2003, Peter Misun wrote:
> >
> > >
> > > I has tried:
> > >   ini_set("mssql.datetimeconvert","0");
> > >
> > > now I tried
> > >   ini_set( 'mssql.datetimeconvert', 0 );
> > > but it didn't work
> > >
> > > I also tried to write to php.ini line
> > >   mssql.datetimeconvert=0
> > > but nothing changed
> > >
> > > 5o
> > >
> > >
> > > Robert Twitty wrote:
> > >
> > > > Did you try:
> > > >
> > > >  ini_set( 'mssql.datetimeconvert', 0 );
> > > >
> > > > -- bob
> > > >
> > > > On Tue, 13 May 2003, Peter Misun wrote:
> > > >
> > > > >
> > > > > you wrote, that option datetimeconvert is available for db-library and i'm using it
> > > > > so why it didn't work?         it has still locale format :-(
> > > > > any idea?
> > > > >
> > > > > 5o
> > > > >
> > > > >
> > > > > Robert Twitty wrote:
> > > > >
> > > > > > php_mssql.dll uses DB-Library.  FreeTDS is used by the sybase ext on
> > > > > > Linux/UNIX installations.
> > > > > >
> > > > > > -- bob
> > > > > >
> > > > > > On Tue, 13 May 2003, Peter Misun wrote:
> > > > > >
> > > > > > >
> > > > > > > I'm using "php_mssql.dll" (45056bytes) extension found in "php-4.3.1-Win32.zip" package
> > > > > > > i have no idea how to determine, which one is it
> > > > > > > where can i get DB-Library version?
> > > > > > >
> > > > > > > 5o
> > > > > > >
> > > > > > >
> > > > > > > Robert Twitty wrote:
> > > > > > >
> > > > > > > > Are you using the FreeTDS version of the mssql ext? Because this option
> > > > > > > > is only available for the DB-Library version. According to FreeTDS docs,
> > > > > > > > it can be changed by the locale setting, but this may not be applicable
> > > > > > > > for the sybase/mssql ext.
> > > > > > > >
> > > > > > > > -- bob
> > > > > > > >
> > > > > > > > On Mon, 12 May 2003, Peter Misun wrote:
> > > > > > > >
> > > > > > > > >
> > > > > > > > > I try to set mssql.datetimeconvert to 0 in php.ini , also with ini_set function, but the result was the same (not "2003-06-01 13:05:11", but that useless format)
> > > > > > > > > why?
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Robert Twitty wrote:
> > > > > > > > >
> > > > > > > > > > The default character format chosen for datetime fields is determined by
> > > > > > > > > > the underlying driver. For ODBC its "2003-06-01 13:05:11.234" and for
> > > > > > > > > > DB-Library and FreeTDS it's "Jun 1 2003 1:05PM". If you set the ini option
> > > > > > > > > > mssql.datetimeconvert to 0, then it will be "2003-06-01 13:05:11". On
> > > > > > > > > > FreeTDS it may also be influenced by the locale setting. It does
> > > > > > > > > > not matter whether you use mssql_fetch_array or mssql_fetch_row.  If you
> > > > > > > > > > want to be certain that your datetime data will always appear a certain
> > > > > > > > > > way then use CONVERT, instead of relying on the driver.
> > > > > > > > > >
> > > > > > > > > > -- bob
> > > > > > > > > >
> > > > > > > > > > On 12 May 2003, Adam Voigt wrote:
> > > > > > > > > >
> > > > > > > > > > > Hmm, what fieldtype is it in the DB?
> > > > > > > > > > > We have a bunch of DATETIME type's, and using
> > > > > > > > > > > a standard query it works just fine, returning
> > > > > > > > > > > in the proper format, without ODBC.
> > > > > > > > > > >
> > > > > > > > > > > The only difference is we use mssql_fetch_array
> > > > > > > > > > > instead of fetch_row.
> > > > > > > > > > >
> > > > > > > > > > > On Mon, 2003-05-12 at 09:12, Peter Misun wrote:
> > > > > > > > > > > > Does anybody know, how to set date-time format for mssql_* functions?
> > > > > > > > > > > >
> > > > > > > > > > > > For example, after retrieving data by function mssql_fetch_row, the value returned was "22 XII 1975 0:00
> > > > > > > > > > > > "  (which is midnight of 22nd December 1975)
> > > > > > > > > > > > As you see, value "XII" (for month) is really unusable
> > > > > > > > > > > >
> > > > > > > > > > > > where to set that date format?
> > > > > > > > > > > >
> > > > > > > > > > > > with odbc functions it returns "1975-12-22 00:00:00.000", wha is really clear
> > > > > > > > > > > >
> > > > > > > > > > > > 5o
> > > > > > > > > > > --
> > > > > > > > > > > Adam Voigt (adam@cryptocomm.com)
> > > > > > > > > > > Linux/Unix Network Administrator
> > > > > > > > > > > The Cryptocomm Group
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > > --
> > > > > > > > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > >
> > > > > > > > > Mgr. Peter Misun
> > > > > > > > > MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
> > > > > > > > > tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > Mgr. Peter Misun
> > > > > > > MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
> > > > > > > tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > >
> > > > > > >
> > > > >
> > > > > --
> > > > >
> > > > > Mgr. Peter Misun
> > > > > MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
> > > > > tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > >
> > > > >
> > >
> > > --
> > >
> > > Mgr. Peter Misun
> > > MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
> > > tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180
> > >
> > >
> > >
>
> --
>
> Mgr. Peter Misun
> MicroStep-MIS, Ilkovicova 3, 841 04 Bratislava, Slovakia
> tel: +421/ 2/ 602 00 127, 111,  fax: +421/ 2/ 602 00 180
>
>
>


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux