<?php /* * description: vrashta format na datata i chasa za BG * primer: [+string:date_bg=`format`+] */ $format = (strlen ( $options ) > 0) ? $options : '%a, %d %B %Y'; setlocale ( LC_TIME, 'bg_BG.UTF-8' ); $date_bg = strftime ( $format, 0 + $output ); return $date_bg; ?>
Output filters : http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters
Use the existing ’:date’ filter, or add your own custom filter.
<?php
/*
* description: localize and format a date
*
*
*
* @author EQUILIBRE WEBDESIGN - Enzo GRAFTIEAUX
* @copyright 2011
* @version 0.2
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License
*/
/* Get Parameters */
$date = $modx->getOption('date', $scriptProperties, "");
if (!$date) return;
$format = $modx->getOption('format', $scriptProperties, "%d %B %Y");
$encoding = $modx->getOption('encoding', $scriptProperties, "fr_FR.UTF-8");
// Set Local
setlocale ( LC_TIME, $encoding );
// Format date
$dateEncoded = strftime($format, strtotime($date));
return $dateEncoded;
Here is a snippet I’ve written for that sort of problem : setLocalDate
<?php /* * description: localize and format a date * * * * @author EQUILIBRE WEBDESIGN - Enzo GRAFTIEAUX * @copyright 2011 * @version 0.2 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License */ /* Get Parameters */ $date = $modx->getOption('date', $scriptProperties, ""); if (!$date) return; $format = $modx->getOption('format', $scriptProperties, "%d %B %Y"); $encoding = $modx->getOption('encoding', $scriptProperties, "fr_FR.UTF-8"); // Set Local setlocale ( LC_TIME, $encoding ); // Format date $dateEncoded = strftime($format, strtotime($date)); return $dateEncoded;
[[!getResources? &parents=`9` &limit=`1` &includeTVs=`1` &tpl=`RappelEvenementTpl`]]
<h1>[[setLocalDate? &date=`[[+tv.DateTV]]`]]</h1>
<a href="[[~[[+id]]]]">
<div class="Texte Conteneur">
<p>[[+tv.ResumeTV:strip_tags:ellipsis=`150`]]</p>
</div>
</a>[[setLocalDate? &date=`[[*publishedon]]`]]
Probably cause Quip is already outputting it in some fancy wayYou are right, Quip format date in Quip snippet L251:
$commentArray['createdon'] = strftime($dateFormat,strtotime($comment->get('createdon')));[[+createdon:strftime]]?It doesn’t work because it’s already a formatted string. Changing format with "dateFormat" parameter is a solution but you can’t localize the date.
$commentArray['createdon'] = $comment->get('createdon');