Click to See Complete Forum and Search --> : Concat variables


dpkyte
09-02-2005, 10:06 PM
Looking to concatenate several variables to form a valid date:

$bdate_mm = 02;
$bdate_dd = 01;
$bdate_cc = 19;
$bdate_yy = 99;
$bdate = ?????????????????/;

Would like $bdate to be 1999-01-02;

Thx in advance.

theuedimaster
09-02-2005, 10:29 PM
Well in php, this is accomplished using periods.

$bdate = $bdate_cc.$bdate_yy."-".$bdate_dd."-".$bdate_mm;

dpkyte
09-02-2005, 10:32 PM
Works great... Thx much

Thx,

DPK

theuedimaster
09-02-2005, 10:37 PM
np :)

NogDog
09-03-2005, 01:21 AM
If you want to make sure you have leading zeros for single digits, use:

$bdate = sprintf("%02d%02d-%02d-%02d",$bdate_mm,$bdate_dd,$bdate_cc,$bdate_yy);