I have a date string (ie dd/mm/yy) which I'm drawing out of a database (ODBC connection to Access) with a Z SQL method and I need to use that data to set the initial condition of a set of 3 select items (ie day, month and year). Is there a way to split this date (it'll come out looking like dd/mm/yy) to get the components of it so that I can do: <select name="start_month"> <dtml-in "1,2,3,4,5,6,7,8,9,10,11,12"> <dtml-if "some_split_of_date_string_to_get_month(start_date) == _['sequence-item']"> <option value="<dtml-var sequence-item>" selected><dtml-var sequence-item></option> <dtml-else> <option value="<dtml-var sequence-item>"><dtml-var sequence-item></option> </dtml-if> </dtml-in> </select> ?? Thanks! Mike Kelland mike@studiomatic.com
<dtml-var "_.string.split(start_date, '/')[1]"> will be the 2nd element of the start_date, in this case mm -- Andy McKay, Developer. ActiveState. ----- Original Message ----- From: "Mike Kelland" <mike@studiomatic.com> To: <zope@zope.org> Sent: Monday, December 04, 2000 1:14 PM Subject: [Zope] string splitting in dtml I have a date string (ie dd/mm/yy) which I'm drawing out of a database (ODBC connection to Access) with a Z SQL method and I need to use that data to set the initial condition of a set of 3 select items (ie day, month and year). Is there a way to split this date (it'll come out looking like dd/mm/yy) to get the components of it so that I can do: <select name="start_month"> <dtml-in "1,2,3,4,5,6,7,8,9,10,11,12"> <dtml-if "some_split_of_date_string_to_get_month(start_date) == _['sequence-item']"> <option value="<dtml-var sequence-item>" selected><dtml-var sequence-item></option> <dtml-else> <option value="<dtml-var sequence-item>"><dtml-var sequence-item></option> </dtml-if> </dtml-in> </select> ?? Thanks! Mike Kelland mike@studiomatic.com
participants (2)
-
Andy McKay -
Mike Kelland