CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Date Formatting Error in CCS common.php

Print topic Send  topic

Author Message
kangus
Posted: 08/13/2002, 1:43 PM

There is a logic problem in the common.php : around line 609 : function CCParseDate($ParsingDate, $FormatMask): around line 640 in the file you'll find:

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;

You'll of course notice that if the IF's don't happen ccsAppropriateYear is not assigned anything, I found it after a few hours.....

The corrected test:

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];
}
}

I have no clue where to put this code so that the next project I start has this bug fixed. You can see the results of the bug at http://acats.com/datetest .. When I checked my other projects I had to insert this code into the common.php to resolve the problem... It's funny that I have customers using this daily and nobody has noticed it.

The error ONLY happens IF there is a defined Date Format for the date field:
if(is_array($FormatMask) && strlen($ParsingDate))
So if you never defined the format of a Date Label this problem would not have appeared.
Nicole
Posted: 08/14/2002, 1:32 AM

Hello,
there's no way for CCS users to change language patterns. The workaround is to edit common.php file for each project.
kangus
Posted: 08/14/2002, 1:59 AM

I have no clue what your talking about but I can tell you I do not want to start hacking my products apart, just get support to fix this.
Thanks
rierson
Posted: 01/25/2003, 10:28 PM

Thanks, Ace. This is a big problem related to formatting weekdays in PHP. The fix for COMMON.PHP worked. I wanted to format the date '2003-02-12 21:00:00' as "Wednesday, February 12, 2002", but the stock codecharge code made my weekday as "Saturday". I thought that I had a Y2K bug or PHP/MySQL issue.

The fix above works and all my weekdays are formatted properly.
Kangus is my hero. Cheers!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.