CodeCharge Studio
search Register Login  

Visual Web Reporting

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

YesSoftware Forums -> CodeCharge Studio -> PHP

 Get a Date as Date and change color if the date is in the future

Print topic Send  topic

Author Message
Taris


Posts: 18
Posted: 06/23/2004, 9:23 AM

Hi I am using PHP, MySQL and CCS2

Following Problem:
I get a date (yyyy-mm-dd) out of my MySQL and I want to compare it to the present date date("Y-m-d")

The Problem is that CCS gets the date as an array, I can change this date with :
$arr_date = $data_source->date_value->GetValue();
$compare_date = $arr_date[1].'-'.$arr_date[2].'-'.$arr_date[3];

so that I can compare the 2 dates date("Y-m-d") and the $compare_date.

When the retrieved date is in the future I want to change the outputcolor to red.

I used:

$data_source->date_value->SetValue("<i style=\"color:red;\">".$data_source->date_value->GetValue()."</i>");



But I do not get a propper output, because the date is reset to 01.01.1970. (no color at all, I guess that CSS compares the new term with a date output and can not handel that the date array is now a string)

Does anyone please have a solution or a hint for me?


PS: Please excuse my English, it is not my native language. ;-) Thanks
View profile  Send private message
Smion
Posted: 07/18/2004, 6:30 AM

Quote Taris:
Hi I am using PHP, MySQL and CCS2

Following Problem:
I get a date (yyyy-mm-dd) out of my MySQL and I want to compare it to the present date date("Y-m-d")

The Problem is that CCS gets the date as an array, I can change this date with :
$arr_date = $data_source->date_value->GetValue();
$compare_date = $arr_date[1].'-'.$arr_date[2].'-'.$arr_date[3];

so that I can compare the 2 dates date("Y-m-d") and the $compare_date.

When the retrieved date is in the future I want to change the outputcolor to red.

I used:

$data_source->date_value->SetValue("<i style=\"color:red;\">".$data_source->date_value->GetValue()."</i>");



But I do not get a propper output, because the date is reset to 01.01.1970. (no color at all, I guess that CSS compares the new term with a date output and can not handel that the date array is now a string)

Does anyone please have a solution or a hint for me?


PS: Please excuse my English, it is not my native language. ;-) Thanks


I tried This and the compwre failed due to date formats.

Try this instead

$compare_date = $arr_date[1].'-'.str_pad($arr_date[2],2,"0",STR_PAD_LEFT).'-'.str_pad($arr_date[3],2,"0",STR_PAD_LEFT);

Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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