|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30898 Returns wrong result under certain circumstances
Submitted: 2004-11-25 17:33 UTC Modified: 2004-12-29 18:33 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: jap1968 at yahoo dot es Assigned:
Status: No Feedback Package: Sybase (dblib) related
PHP Version: 4.3.8 OS: Linux (RedHat 9)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
33 + 41 = ?
Subscribe to this entry?

 [2004-11-25 17:33 UTC] jap1968 at yahoo dot es
When using a LC_TIME locale which do represent time in 0..24h manner in spite of using AM/PM, wrong results are obtained.

Results are always in the range 0..11, so if the time corresponds to a PM hour, the returned result is wrong. It does not correspond with the real value stored in the database!

Reproduce code:
// Asking a MS_SQLServer through FreeTDS + Sybase functions

  $linkBD = sybase_connect("SGBD", "user", "pass");
  sybase_select_db("BD", $linkBD);
  $query = "select fecha from table";

/* RIGHT */

  setlocale (LC_TIME, "en_US");  // Returns correct time
  $res = sybase_query($query, $linkBD);
  if ($fila = sybase_fetch_array($res)) {
    $fecha = $fila['fecha'];
    echo 'en_US'.$fecha;

/* WRONG */
  setlocale (LC_TIME, "es_ES"); // Returns wrong time
  $res = sybase_query($query, $linkBD);
  if ($fila = sybase_fetch_array($res)) {
    $fecha = $fila['fecha'];
    echo 'es_ES'.$fecha;


Expected result:
en_US:NOV 25 2004 01:00PM
es_ES:nov 25 2004 01:00

Actual result:
en_US:NOV 25 2004 01:00PM
es_ES:nov 25 2004 13:00


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-25 17:36 UTC] jap1968 at yahoo dot es
"Expected" and "Actual" are interchanged. Sorry for the mistake!
 [2004-12-22 05:42 UTC]
What is the freetds version you're using?
And do read this:

It would suggest that this is not any bug anywhere but just
a configuration issue..

 [2004-12-29 18:33 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Aug 14 17:01:26 2020 UTC