This topic is locked

conditional format date

5/1/2008 5:18:34 AM
PHPRunner General questions
G
garethp authorDevClub member

I require a date field in a list screen to be red if it is the current date. I have applied the follwing custom code on the visual editor and this works great..

$curd = date("Y-m-d",strtotime(now()));

if ($value ==$curd)

{

$value = "<font color=red>".$value."</font>";

$value = "<strong>".$value."</font>";
}


However this changed the format of the field to 2008-05-01 sytle where as all my other dates are 25/02/2008 style.
I have tried everything I can think of - please can someone help to show the field in the same 25/02/2008 format as all the others.
Many thanks
Gareth

Alexey admin 5/1/2008

Gareth,
try to change this line in your code:

$value = "<font color=red>".format_shortdate(db2time($value))."</font>";

G
garethp authorDevClub member 5/2/2008

works a treat - thankyou as always for great and quick support