Jump to content

Recommended Posts

hey!

 

i have FPDF (php script that generates pdf files from variables). I can get the from date and to date to show, but they show like this: e.g.: 2006-12-20

 

now im trying to do this but its not working:

 

<?

$curDate = array(

'01' => 'January',

'02' => 'Feruary',

'03' => 'March',

'04' => 'April',

'05' => 'May',

'06' => 'June',

'07' => 'July',

'08' => 'August',

'09' => 'September',

'10' => 'October',

'11' => 'November',

'12' => 'December'

);

 

$frmdate = $row['formdate'];

$frmdate = explode("-", $frmdate);

 

$todate = $row['todate'];

$todate = explode("-", $todate)

 

 

$pdf->SetFont( 'Arial', '', 9 );

$pdf->Cell( 30, 5, "Available:", 0, 0, 'L' );

    $pdf->Cell( 0, 5, "$curDate[$frmdate[1]]; $frmdate[2];, $frmdate[0]; to $curDate[$todate[1]]; $todate[2]; , $todate[0]; ", 0, 1, 'L' );

?>

 

 

originally, the FROM date is referenced as: $l_formdate

the TO date is referenced as: $l_todate

 

i know there was a typo in the from date and it became formdate so dont worry about that.

 

Any help would be amazing

Cheers

André

You want to use a combination of the strtotime() and date()[/functions]:

<?php
$frmdate = date('F j, Y', strtotime($row['formdate']));
$todate = date('F j, Y',strtotime($row['todate']));
$pdf->SetFont( 'Arial', '', 9 );
$pdf->Cell( 30, 5, "Available:", 0, 0, 'L' );
$pdf->Cell( 0, 5, $frmdate . ' to ' . $curDate, 0, 1, 'L' );
?>

 

Ken

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.