Forums

strtotime , strftime

dorine@dpwebsites.nl 09 Jun, 2015
Hi all,

On a previous Chronoconnectivity (V 4.0 RC3.2 ) on Joomla 2.5 I was able to use strftime to format the date but in V5 this results in: "donderdag 1 januari 1970 - 00:00"
Now I use
MyModel.date:return date("l d F Y -  H:i", strtotime($cell));
in the PHP functions box but this way all dates are only displayed in English.

How can I use strftime in combination with strtotime to format the dates?

Thanks in advance.

Regards, Dorine
GreyHead 11 Jun, 2015
Hi Dorine,

I think that strftime() should still work - what exactly is the code you are using? And what is the problem exactly?

Bob
dorine@dpwebsites.nl 11 Jun, 2015
Hi Bob,

The code I use on http://www.truelightdaglichtlampen.nl/klantreacties is:

<?php

function formatDate($val)
	{
	 setlocale (LC_ALL, 'nl_NL');
	 list($date, $time) = explode(" ", $val);
	 list($year, $month, $day) = explode("-", $date);
	 list($hour, $minute, $second) = explode (":", $time);
	 return strftime ("%A %B %e %Y", mktime($hour, $minute, $second, $month, $day, $year));
	}
?>


with:
<?php
$berichtDate = formatDate($row['date']); echo "$berichtDate";?>


As you can see on the page above this works fine in the older Chronoconnectivity version.
But using the same code in the current version with the same Custom Listing Settings all message show the date June 1 1970

The admin part of the guest book is not using Chronoforms but a custom script and uses the same code without date problems.

Dorine
This topic is locked and no more replies can be posted.