Forum OpenACS Development: Re: Res: Form validation of dates

Collapse
Posted by Jose Pablo Escobedo Del Cid on
Hi Henry,

I use the date template in the ad_form like this:

{due_date:date,to_sql(linear_date),from_sql(sql_date),optional
{label "label"}
{format "MONTH DD YYYY HH24 MI SS"}
{today}
{help}
{value {default date in format mm dd yyyy hh24 mi ss, using template::util::date::create}}
}

and before inserting into de database, you have to convert the date to a valid format, like this: (my data type is timestamp)

set due_date_ansi [db_string set_date "select to_timestamp('[template::util::date::get_property linear_date $due_date]','YYYY MM DD HH24 MI SS')"

and that's it, I hope this helps.

Regards,

jopez