Forums

Date Format in body section of CC

shoaib 09 Sep, 2010
Hi,

I am using CC for filtering the table on dropdown change.


In body section I have the coding like this

 <table style="text-align: left; width: 99%;" border="1" >

            <tr<?php if ($i % 2) echo ' style="background-color: #EBEBEB;"';?>>

              <td style="width: 20%;"><a href=index.php?option=com_chronocontact&chronoformname=studycenter_linkpage&v_name={fabrik_internal_id}>{Project_Name}</a></td>
              <td style="width: 20%;">{Village}</td>
              <td style="width: 20%;">{Estimated_Cost_Rs}</td>
              <td style="width: 20%;">{Expected_Start_Date}</td> 
              <td style="width: 20%;">{Expected_Complete_Date}</td>
             
            </tr>
         
      </table>
        <?php $i++ ?>


I would like to add the functionaliy of "DATE_FORMAT( value , '%Y/%m/%d') "

can you help me how can I apply this funtion on the {Expected_Start_Date}


Regards,
Shoaib
GreyHead 10 Sep, 2010
Hi shoaib,

You need to add a little PHP to format the date in the Body section. What the code needs to be depends on what is being returned from the database query. In general you can access a varible with $MyRow->variable_name

Bob

PS You will usually get better page layout by putting the <table> andd </table> tags in the Header & Footer boxes rather than the Body box.
shoaib 16 Sep, 2010
Hi,

As you said I used php header some thing like this


   <td style="width: 20%;"><?php $pre = strtotime('Expected_Start_Date');
 echo date('Y/m/d',$pre); ?></td> 


But Here I get all the values like this "1969/12/31". For all the data I get the contans value "1969/12/31".

Example:

If the Date is "2010-08-02 00:00:00" I get the result "1969/12/31".

Regards,
Shoaib.
GreyHead 16 Sep, 2010
Hi Shoaib,

I'm pretty certain that isn't anything I said. 'Expected_Start_Date' is a string and can't be converted to a date - so the result you get is the PHP equivalent of '00/00/0000'

Try with $MyRow->Expected_Start_Date but you really need some PHP help here.

Bob
shoaib 16 Sep, 2010
Hi Bob,

Thanks it worked. It worked with


<?php 
$va = $MyRow->Expected_Complete_Date;
$date = $va;
$date = date('m-d-Y', strtotime($date));
echo  $date;  ?>


Regards,
Shoaib.
This topic is locked and no more replies can be posted.