michael weaver
|
| Posted: 11/05/2002, 1:59 PM |
|
Hi, I'm storing dates in a mysql database in the following format:
yyyy-mm-dd (ex: 2002-11-05). Everything has been going fine until I just
noticed that when I display the dates as dddd, mmmm d, yyyy (ex: Tuesday,
November 5, 2002) it gives me the wrong day. For instance, for a database
entry for today, it will read 2002-11-05 in the database, but when it
displays it will say Sunday, November 5, 2002 instead of Tuesday November 5,
2002.
Using PHP+templates. Same behaviour on two linux servers. Everything else
seems to be going well.
Anyone have some advice?
michael
|
|
|
 |
Jonathan Berens
|
| Posted: 11/06/2002, 12:41 AM |
|
michael
There is a missing line of code in the fuction "CCParseDate" of common.php -
see the snippet below
Maybe Yes Software will fix it in the next release
Jonathan
// Begin bug ammend to correct problem with invalid date - weekday does not
match dd/mm/yy
if($DateArray[ccsYear] < 1971 && $DateArray[ccsYear] > 0)
{
$DateArray[ccsAppropriateYear] = $DateArray[ccsYear] + intval((2000 -
$DateArray[ccsYear]) / 28) * 28;
}
else
{
if ($DateArray[ccsYear] > 2030)
{
$DateArray[ccsAppropriateYear] = $DateArray[ccsYear] -
intval(($DateArray[ccsYear] - 2000) / 28) * 28;
}
else
{
$DateArray[ccsAppropriateYear] = $DateArray[ccsYear]; // Added
line
}
}
// End bug amend to date
michael weaver <zero@michaelweaver.org> wrote in message
news:aq9f0t$11n$1@news.codecharge.com...
> Hi, I'm storing dates in a mysql database in the following format:
> yyyy-mm-dd (ex: 2002-11-05). Everything has been going fine until I just
> noticed that when I display the dates as dddd, mmmm d, yyyy (ex: Tuesday,
> November 5, 2002) it gives me the wrong day. For instance, for a database
> entry for today, it will read 2002-11-05 in the database, but when it
> displays it will say Sunday, November 5, 2002 instead of Tuesday November
5,
> 2002.
>
> Using PHP+templates. Same behaviour on two linux servers. Everything else
> seems to be going well.
>
> Anyone have some advice?
>
> michael
>
>
|
|
|
 |
michael weaver
|
| Posted: 11/06/2002, 7:44 AM |
|
Thanks Jonathan - that did the trick. I agree - hopefully this will be fixed
by the next relese.
It was showing the dates from the current year, but the days from 2000 ...
is this actually a Y2K bug? 
michael
"Jonathan Berens" <berensjd@dial.pipex.com> wrote in message
news:aqakk0$39f$1@news.codecharge.com...
> michael
>
> There is a missing line of code in the fuction "CCParseDate" of
common.php -
> see the snippet below
>
> Maybe Yes Software will fix it in the next release
>
> Jonathan
>
> // Begin bug ammend to correct problem with invalid date - weekday does
not
> match dd/mm/yy
> if($DateArray[ccsYear] < 1971 && $DateArray[ccsYear] > 0)
> {
> $DateArray[ccsAppropriateYear] = $DateArray[ccsYear] +
intval((2000 -
> $DateArray[ccsYear]) / 28) * 28;
> }
> else
> {
> if ($DateArray[ccsYear] > 2030)
> {
> $DateArray[ccsAppropriateYear] = $DateArray[ccsYear] -
> intval(($DateArray[ccsYear] - 2000) / 28) * 28;
> }
> else
> {
> $DateArray[ccsAppropriateYear] = $DateArray[ccsYear]; // Added
> line
> }
> }
> // End bug amend to date
>
>
>
>
> michael weaver <zero@michaelweaver.org> wrote in message
>news:aq9f0t$11n$1@news.codecharge.com...
> > Hi, I'm storing dates in a mysql database in the following format:
> > yyyy-mm-dd (ex: 2002-11-05). Everything has been going fine until I just
> > noticed that when I display the dates as dddd, mmmm d, yyyy (ex:
Tuesday,
> > November 5, 2002) it gives me the wrong day. For instance, for a
database
> > entry for today, it will read 2002-11-05 in the database, but when it
> > displays it will say Sunday, November 5, 2002 instead of Tuesday
November
> 5,
> > 2002.
> >
> > Using PHP+templates. Same behaviour on two linux servers. Everything
else
> > seems to be going well.
> >
> > Anyone have some advice?
> >
> > michael
> >
> >
>
>
|
|
|
 |
|