[pmwiki-users] {(...)} markup recipe available
Patrick R. Michaud
pmichaud at pobox.com
Mon Apr 16 10:03:56 CDT 2007
On Mon, Apr 16, 2007 at 09:51:36AM -0500, Patrick R. Michaud wrote:
> On Mon, Apr 16, 2007 at 10:28:38AM -0400, The Editor wrote:
> > I've been using the {(time)} markup, now changed to {(ftime)} by Pm.
> > But can no longer get it to produce a pure timestamp. Wish that had
> > been the default.
>
> ...
> There's always:
>
> $FmtPV['$Now'] = $Now;
Actually, presuming that one wants to get unix timestamps from
a variety of date and time formats, I'd propose making it explicit
with an expression name like 'timestamp', 'tstamp', 'unixtime',
'mktime', or something like that. For example:
$MarkupExpr['tstamp'] = 'ME_ftime("%s", $args[0], $argp)';
Then you get
{(tstamp)} now
{(tstamp tomorrow)} 24 hours from now
{(tstamp 2007-04-16)} April 16, 2007
{(tstamp '-3 hours')} 3 hours ago
and the expression name leaves little confusion about
what will be produced.
2.2.0-beta44 also introduces an $FTimeFmt variable, which allows
an administrator to set the default format for {(ftime ...)} .
(If not set, it defaults to $TimeFmt.)
Pm
More information about the pmwiki-users
mailing list