Formatierungsanweisungen im Ausdruck
(deutsche Übersetzung der Seite PmWiki.MarkupExpressions, Stand englisch)
The "substr" expression extracts portions of a string. The first argument is the string to be processed, the second argument is the initial position of the substring, and the third argument is the number of characters to extract. Note that the initial position argument is zero-based (i.e., the first character is referenced via a "0").
To obtain the last n characters of a string use
"Ftime" expressions are used for date and time formatting. The generic form is
where fmt is a formatting string and when is the time to be formatted. The arguments can be in either order and may use the optional "fmt=" and "when=" labels.
The fmt parameter is whatever is given by "fmt=", the first parameter containing a '%', or else the site's default. The formatting codes are described at http://php.net/strftime. In addition to those, 's' produces Unix timestamps. Some common formatting strings:
%F # ISO-8601 dates "2018-06-25" %s # Unix timestamp "1529940942" %H:%M:%S # time as hh:mm:ss "17:35:42" %m/%d/%Y # date as mm/dd/yyyy "06/25/2018" "%A, %B %d, %Y" # in words "Monday, June 25, 2018"
The when parameter understands many different date formats. The when parameter is whatever is given by "when=", or whatever parameter remains after determining the format parameter. Some examples:
2007-04-11 # ISO-8601 dates 20070411 # dates without hyphens, slashes, or dots 2007-03 # months @1176304315 # Unix timestamps (seconds since 1-Jan-1970 00:00 UTC) now # the current time today # today @ 00:00:00 yesterday # yesterday @ 00:00:00 "next Monday" # relative dates "last Thursday" # relative dates "-3 days" # three days ago "+2 weeks" # two weeks from now
Note: If you want to convert a Unix timestamp you must prefix with the @. Thus,
The "strlen" expression returns the length of a string. The first argument is the string to be measured.
The "rand" expression returns a random integer. The first argument is the minimum number to be returned and the second argument is the maximum number to be returned. If called without the optional min, max arguments rand() returns a pseudo-random integer between 0 and RAND_MAX. If you want a random number between 5 and 15 (inclusive), for example, use rand (5, 15).
toupper / tolower
The "toupper" and "tolower" expressions convert a string into uppercase or lowercase. The first argument is the string to be processed.
The "ucfirst" expression converts the first character of a string to uppercase. The first argument is the string to be processed.
The "ucwords" expression converts the first character of each word in a string to uppercase. The first argument is the string to be processed.
The "pagename" expression builds a pagename from a string. The first argument is the string to be processed.
The "asspaced" expression formats wikiwords. The first argument is the string to be processed.
Markup expressions can be nested: