[pmwiki-users] Question about ftime?

TSgt Marshall Kelly marshall.kelly at txsg.org
Sun Dec 30 12:28:46 CST 2007


When I was trying to figure ftime out I pasted the following into a
practice page. Maybe it will help....:

ftime %A {(ftime %A )}
ftime %B {(ftime %B )}
ftime %C {(ftime %C )}
ftime %D {(ftime %D )}
ftime %E {(ftime %E )}
ftime %F {(ftime %F )}
ftime %G {(ftime %G )}
ftime %H {(ftime %H )}
ftime %I {(ftime %I )}
ftime %J {(ftime %J )}
ftime %K {(ftime %K )}
ftime %L {(ftime %L )}
ftime %M {(ftime %M )}
ftime %N {(ftime %N )}
ftime %O {(ftime %O )}
ftime %P {(ftime %P )}
ftime %Q {(ftime %Q )}
ftime %R {(ftime %R )}
ftime %S {(ftime %S )}
ftime %T {(ftime %T )}
ftime %U {(ftime %U )}
ftime %V {(ftime %V )}
ftime %W {(ftime %W )}
ftime %X {(ftime %X )}
ftime %Y {(ftime %Y )}
ftime %Z {(ftime %Z )}

ftime %a {(ftime %a )}
ftime %b {(ftime %b )}
ftime %c {(ftime %c )}
ftime %d {(ftime %d )}
ftime %e {(ftime %e )}
ftime %f {(ftime %f )}
ftime %g {(ftime %g )}
ftime %h {(ftime %h )}
ftime %i {(ftime %i )}
ftime %j {(ftime %j )}
ftime %k {(ftime %k )}
ftime %l {(ftime %l )}
ftime %m {(ftime %m )}
ftime %n {(ftime %n )}
ftime %o {(ftime %o )}
ftime %p {(ftime %p )}
ftime %q {(ftime %q )}
ftime %r {(ftime %r )}
ftime %s {(ftime %s )}
ftime %t {(ftime %t )}
ftime %u {(ftime %u )}
ftime %v {(ftime %v )}
ftime %w {(ftime %w )}
ftime %x {(ftime %x )}
ftime %y {(ftime %y )}
ftime %z {(ftime %z )}


> Today's Topics:
>
>    1. PmForm won't save data to page (Knut Alboldt)
>    2. Question about ftime? (christian.ridderstrom at gmail.com)
>    3. Re: Question about ftime? (sti at pooq.com)
>    4. How to Override Zebra Table colors (Russell Montgomery)
>    5. How to implement an alternate naming scheme for pages
>       (Vincent Isles)
>
>
> ----------------------------------------------------------------------
>
> Message: 2
> Date: Sat, 29 Dec 2007 22:31:26 +0100
> From: christian.ridderstrom at gmail.com
> Subject: [pmwiki-users] Question about ftime?
> To: pmwiki-users at pmichaud.com
> Message-ID: <Pine.LNX.4.64.0712292218010.5863 at ssh-01.md.kth.se>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Is it correct that
>  	{(ftime "%Y" "-")}
> should produce
>  	2007
>
> I'm actually looking for a way to extract the year from a page text
> variable that could look like this:
>
>  	:Deceased: 2003-12-01 Stockholm
>
> where the person died in 2003. Or like this
>
>  	:Deceased: -
>
> where the person is still alive, or possibly like this
>
>  	:Deceased: ?
>
> where it's unknown when the person died.
>
> Ideas?
>
> /Christian
>
> --
> Christian Ridderstr?m, +46-8-768 39 44
> http://www.md.kth.se/~chr
>
> ------------------------------
>
> Message: 3
> Date: Sat, 29 Dec 2007 18:38:36 -0500
> From: sti at pooq.com
> Subject: Re: [pmwiki-users] Question about ftime?
> To: pmwiki-users at pmichaud.com
> Message-ID: <4776DA7C.5040401 at pooq.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> christian.ridderstrom at gmail.com wrote:
>> Is it correct that
>>     {(ftime "%Y" "-")}
>> should produce
>>     2007
>>
>> I'm actually looking for a way to extract the year from a page text
>> variable that could look like this:
>>
>>     :Deceased: 2003-12-01 Stockholm
>>
>> where the person died in 2003. Or like this
>>
>>     :Deceased: -
>>
>> where the person is still alive, or possibly like this
>>
>>     :Deceased: ?
>>
>> where it's unknown when the person died.
>>
>> Ideas?
>>
> ftime uses defaults whenever it doesn't recognize a parameter. For
> unrecognized dates it always uses the current time. One way to get the
> effect you want is to nest ftime within another markup expression. A
> quick look through the possibilities doesn't show any existing ones that
> quite do the job, so you may have to roll your own. What you want is
> something like this (note that I'm using the MarkupExprPlus recipe):
>
> {(if (test isdate {$:Deceased}) (ftime "%Y" {$:Deceased}) {$:Deceased}))}
>
> This would require you to define a new conditional called 'isdate' which
> would look something like this (note that I haven't tested it):
>
> $Conditions['isdate'] = 'preg_match("/\d\d\d\d-\d\d-\d\d/",$condparm)';
>
> This assumes, of course, that all valid dates are strict ISO. If you
> have other date formats, then isdate gets a lot more complex.
>
>

-- 
Marshall Kelly, TSgt, 5AW 401ASG
512-293-8783




More information about the pmwiki-users mailing list