The ad hoc query tcl procs in AOlserver 2.3.3 had procedures to split dates up and such. If you have an AS2.3.3 tree lying around, see ns_dbformvalueput in modules/tcl/nsdb/forms.tcl
Nathan Folkman mentioned a few weeks ago in the AOLserver chat (or maybe it was by e-mail, I can't recall) that it may be possible for the old TCL procs in 2.3.3 (which did some really neat things) might be released GPL/APL at some point.
I know this because I still have an AS2.3.3 tree lying around, which I use on occasion for CSV import and ad hoc form queries (which it does very well). I just updated my local copy of forms.tcl for PostgreSQL 7.2.4 which is running my OACS instances.