calc element with condition

runza

Member
hie
i have a calc date that return a text from two date element : debut and fin date

i would like to make a condition in this calc date when the fin date is empty
the calc date is figure only in the debut date in order to return a stupid result with a date "janvier 1970 "
i use this formula but it doesn't work i probably forget an element
best regard
philippe

$debut= '{agenda_evenement___debut}';
$fin= '{agenda_evenement___fin}';
$tdebut = strftime("%d %B %Y",strtotime("$debut"));
$tfin= strftime("%d %B %Y",strtotime("$fin"));
if ($fin = "0000-00-00 00:00:00")
{tdate="Du"." ".$tdebut." "."au".$tfin;}
else {tdate="Le"." ".$tdebut;}
return tdate;
 
Hi

In the if statement you are assigning something to tdate, but it should be $tdate.
 
variable null

thanks for your answer but the formula doesn't work

i don"t how i can figure that the end date is empty in the formula
best regard
philippe

$debut= '{agenda_evenement___debut}';
$fin= '{agenda_evenement___fin}';
setlocale (LC_TIME, 'fr_FR.utf8','fra');
$tdebut = strftime("%d %B %Y",strtotime("$debut"));
$tfin= strftime("%d %B %Y",strtotime("$fin"));
if ($tfin = "01 janvier 1970")
{$tdate="Le"." ".$tdebut;}
else {$tdate="Du"." ".$tdebut." "."au".$tfin;}
return $tdate;
 
Try

$debut= '{agenda_evenement___debut}';
$fin= '{agenda_evenement___fin}';
setlocale (LC_TIME, 'fr_FR.utf8','fra');
$tdebut = strftime("%d %B %Y",strtotime($debut));
$tfin= strftime("%d %B %Y",strtotime($fin));
if ($tfin == "01 janvier 1970")
{$tdate="Le ".$tdebut;}
else {$tdate="Du ".$tdebut." au ".$tfin;}
return $tdate;
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top