[Zope-dev] date formatting / extracting substrings

Paul Erickson erickson@kaivo.com
Thu, 07 Sep 2000 12:01:24 -0600


If you've already done some validation and can guarantee that there are
6 characters in the string, you can slice the month out of the string
like this:

<dtml-call "REQUEST.set('MonthValue', MonthID[4:6])">

or, if you just want to display the month, use this:

<dtml-var expr="MonthID[4:6]">

-Paul

Jeff Nielsen / Ugo Fast wrote:
> 
> Hello out there in Zope world!
> 
> Again, I'm completely baffled by Zope and the docs are no help either. I'm
> trying to take an input of a date in the form YYYYMM as the variable MonthID
> and create a string in the form Month, YYYY as a variable named MonthName.
> For instance, a MonthID of 200009 should return a MonthName of "September,
> 2000".
> 
> I've been looking in the docs and the emails, but I can't figure out how to
> extract substrings. I think something like this should work to seperate the
> month value from the MonthID, but it doesn't:
> 
> <dtml-call "REQUEST.set('MonthValue', _.substring(MonthID,5,2))">
> 
> Any guidance would be appreciated.
> 
> -----------------------
> Jeff Nielsen
> http://www.UgoFast.com/
> "Where U Go Fast"
> 

-- 
Paul Erickson       | erickson@kaivo.com
Kaivo, Inc.         | www.kaivo.com