Home about IT Motivation Course Sales Project About Me

Monday, January 26, 2009

TCPDF: convert format date

for library tcpdf: below example to changes format date yyyy-mm-dd to dd-mm-yyyy:

example_014.php:
//Date of the day (determined and formatted by JS)
$pdf->Write(5, 'Date: ');
$pdf->TextField('date', 30, 5);
$pdf->IncludeJS("getField('date').value=util.printd('dd/mm/yyyy',new Date());\n");
$pdf->Ln();
$pdf->Write(5, 'Signature:');
$pdf->Ln(3);


example date from database:
$time =explode("-","$data1[date_sspcp]");
krsort($time);
$ts = implode("-",$time);
//$pdf->Text(10, 10, $ts);
$pdf->Cell(320, 117, $ts, 0, 1, 'C', 0, '', 0);

No comments: