Return to Snippet

Revision: 61369
at December 8, 2012 04:59 by steho


Initial Code
<!-- ####################################################################
The code has to be placed between a <we:customer id="\$id"></we:customer>
##################################################################### -->

<we:field type="date" name="Client_DateNaissance" format="d.m.Y" to="global" nameto="birthday" />			  

<?php
$datetime1 = new DateTime($birthday);
$datetime2 = new DateTime(); // creates the actual date
$interval = $datetime1->diff($datetime2);
$age = $interval->format('%y');
?>

<we:field type="date" name="Client_DateNaissance" format="d.m.Y" /> à <we:field type="print" name="Client_LieuNaissance" />. <we:ifVar type="global" name="age" match="18" operator="greater"><span style="color:green;">Il a  <we:var type="global" name="age" /> ans.</span> <we:else /><span style="color:red; font-weight:bold;">Il a  <we:var type="global" name="age" /> ans.</span></we:ifVar>

Initial URL


Initial Description
PHP script calculating the age of a customer coming from a webEdition field of the customer management.

Initial Title
Calculates the age out of a webEdition date field of a customer

Initial Tags
date

Initial Language
PHP