MarkupExpressions-Sandbox

Feel free to use this page to experiment with the MarkupExpressions recipe (superceded by PmWiki.Markup Expressions)

rand

{(rand)} | {(rand 01 20)} | {(rand 1 20)}  

1453684474 | 14 | 8

ftime

See http://www.php.net/strftime for date/time parameters.

MyDate:2007-04-12

  now:        {(ftime)}
  date:       {(ftime %F)}
  yesterday:  {(ftime %F yesterday)}
  tomorrow:   {(ftime %F tomorrow)}
  April 31st: {(ftime %F "2007-04-30 +1 day")}
  Unix time:  {(ftime '' @1176304315)}
  fmt=%s      {(ftime %s)}
  offset:     {(ftime '' "@1176304315 +3 hours")}
  reversed arguments:
              {(ftime when=now fmt=%F)}
  page-text-variable:
              {(ftime '%A %B %e, %Y' {$:MyDate})}
              {(ftime '%A %B %e, %Y' '{$:MyDate} -2days')}

  now:        July 16, 2019, at 08:07 AM
  date:       2019-07-16
  yesterday:  2019-07-15
  tomorrow:   2019-07-17
  April 31st: 2007-05-01
  Unix time:  July 16, 2019, at 08:07 AM
  fmt=%s      1563264431
  offset:     July 16, 2019, at 08:07 AM
  reversed arguments:
              2019-07-16
  page-text-variable:
              Thursday April 12, 2007
              Tuesday April 10, 2007
{(ftime '%b %d, %Y %I:%M %p')}

Jul 16, 2019 08:07 AM

substr

{(substr "Hello World" 2 5)}

llo W

{(substr {$Name} 2 3)}

rku

''Separately:''

{(ftime '%A, %d %B, %Y' 20071019)}

{(substr 20071019-SomeHybridPageName 0 8)}

''Wrong:''

{(ftime '%A, %d %B, %Y' 20071019-SomeHybridPageName)}

{(ftime '%A, %d %B, %Y' {(substr 20071019-SomeHybridPageName 0 8)})}

''Right:''

{(ftime '%A, %d %B, %Y' (substr 20071019-SomeHybridPageName 0 8))}

Separately:

Friday, 19 October, 2007

20071019

Wrong:

Friday, 19 October, 2007

(ftime d Y {20071019)}

Right:

Friday, 19 October, 2007

fmt=#datenames

Use with pagelist that specifies name=20[0-9][0-9][0-9][0-9]* (e.g. 20071019)

(:if false:)
[[#datenames]]
* [[{=$FullName}|{(ftime '%a, %d %b, %Y' (substr {=$Name} 0 8))}]]
[[#datenamesend]]
(:ifend:)

(:pagelist group=Test name=20[0-9][0-9][0-9][0-9]* fmt=#datenames count=5:)

pagename


    {(pagename "Try this.  Really. Test's pages:fun or not?")}

    {(pagename "Try this  Really Test's pages:fun or not?")}

{(pagename Donald O'Connel)}

    Cookbook.TryThisReallyTestsPagesFunOrNot

Cookbook.DonaldOConnel


  Variable : 23

  {$:Variable}

  {(eval {$:Variable}+2)}

  Variable : 23

  23

  (eval 23+2)