date formatting / extracting substrings
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"
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
participants (2)
-
Jeff Nielsen / Ugo Fast -
Paul Erickson