Reg. Comparing 2 Dates

Hi,
I want to compare date from the database to system date and time and change the color of the field in the grid.

anyone has any idea or piece of code…!
I found lot of stuff in googlebut doesn’t help any more…!

SC has any shotcut way to do this…?

Regards
Dhana

Re: Reg. Comparing 2 Dates

onRecord:


if ({date_x} < date('Y-m-d') ) {
 sc_field_color('date_x','#ff0000');
} else { sc_field_color('date_x',''); }

Re: Reg. Comparing 2 Dates

Scott,
Thanks…! Also, i had found sc_dif_date macro does the same thing

Regards
Dhana

Re: Reg. Comparing 2 Dates

I usually try to use straight PHP code instead of depending SC macros so my code is consistent. SC does not have macros for everything and it can get confusing to have ‘mixed’ code in your app.

Regards,
Scott.