Forum OpenACS Q&A: Response to Forms: Date type, Avoiding --

Posted by Stan Kaufman on
I hope I'm tracking your question correctly: what I've found to work is to strip out the time entirely before passing the value to ad_form and then reconstructing a date format that the DB is happy with later. For example (using PG):

set now [db_string now_str "select to_char(current_timestamp,'YYYY MM DD') from dual"]

ad_form -name test -form {
      {label "Start Date"}
      {value $now}
} -new_data {
   set start_date_ansi "[lindex $start_date 0]-[lindex $start_date 1]-[lindex $start_date 2]"
   db_transaction {
      do the insert etc..

There may well be a more elegant way to use the API than this, but this does definitely work.