Hi all quick question
using CC I am looking for a way to display the recordtime column in the format DD/MM/YY
I found the code below which will display the MM/DD/YYYY format
I have played with it to try and get it the way i need it but no joy.
anyone know how I can do this?
using CC I am looking for a way to display the recordtime column in the format DD/MM/YY
I found the code below which will display the MM/DD/YYYY format
<?php
$date=explode(' ',$MyRow->recordtime);
echo $date[("0")];
?>
I have played with it to try and get it the way i need it but no joy.
anyone know how I can do this?
Hi darrenhallinan ,
Please try
Bob
Please try
<?php
$date = strtotime($MyRow->recordtime);
$date = date('m/d/Y', $date);
?>
. . .
<?php echo $date; ?>
Bob
<?php
$date = strtotime($MyRow->recordtime);
$date = date('m/d/Y', $date);
?>
. . .
<?php echo $date; ?>
Tried that Bob
The result is that each date shows as 01/01/1970
close but no cigar!
Hi darrenhallinan,
Please add some intermediate echo statements to see what the value is at each step. It could be that $myRow->recordtime is empty, or I've got the syntax wrong . . .
Bob
Please add some intermediate echo statements to see what the value is at each step. It could be that $myRow->recordtime is empty, or I've got the syntax wrong . . .
Bob
I think the syntax may be wrong, I have same issue and I too get 01/01/1970
Have checked recordtime and it is not empty.
This is what I have in the Body:
Have checked recordtime and it is not empty.
This is what I have in the Body:
<?php
$date = strtotime($MyRow->recordtime);
$date = date('d/m/Y', $date);
?>
<tr><td class="table_norm" align="center">{stu_surname}</td><td class="table_norm">{stu_firstname}</td><td class="table_norm">{userscode}</td><td class="table_norm">{role}</td>
<td class="table_norm">
<?php echo $date; ?></td>
<td class="table_norm">{schoolcode}</td><td class="table_norm" align="center"><a href='index.php?option=com_chronocontact&chronoformname=FA001_records&id={cf_id}'>View</a></td><td class="table_norm">{edit_record}</td><td class="table_norm">{delete_record}</td></tr>
I think the syntax may be wrong, I have same issue and I too get 01/01/1970
Have checked recordtime and it is not empty.
This is what I have in the Body:
<?php
$date = strtotime($MyRow->recordtime);
$date = date('d/m/Y', $date);
?>
<tr><td class="table_norm" align="center">{stu_surname}</td><td class="table_norm">{stu_firstname}</td><td class="table_norm">{userscode}</td><td class="table_norm">{role}</td>
<td class="table_norm">
<?php echo $date; ?></td>
<td class="table_norm">{schoolcode}</td><td class="table_norm" align="center"><a href='index.php?option=com_chronocontact&chronoformname=FA001_records&id={cf_id}'>View</a></td><td class="table_norm">{edit_record}</td><td class="table_norm">{delete_record}</td></tr>
Hello to all!
The solution is...
<?php
$date = DateTime::createFromFormat('Y-m-d - H:i:s', $dataItem->recordtime);
echo $date->format('l, d \d\e F \d\e Y');
?>
For more information visit: http://www.php.net/manual/en/datetime.createfromformat.php
Greetings😀 !
Armando,
Thanks for your suggestion.
When I input your code I am given the following error:
Fatal error: Call to undefined method DateTime::createFromFormat() in (root removed by me)/components/com_chronoconnectivity/libraries/connection.php(303) : eval()'d code on line 2
Thanks for your suggestion.
When I input your code I am given the following error:
Fatal error: Call to undefined method DateTime::createFromFormat() in (root removed by me)/components/com_chronoconnectivity/libraries/connection.php(303) : eval()'d code on line 2
Hi Laus,
Please check the PHP manual reference; the function that Armando has used is only available from PHP 5.3.0
Bob
Please check the PHP manual reference; the function that Armando has used is only available from PHP 5.3.0
Bob
This topic is locked and no more replies can be posted.