Forum OpenACS Q&A: Response to formatting timestamps

Collapse
Posted by Don Baccus on
We need all the documentation we can get, of course.

There is one instance when formatting the date time outside the database isn't silly.  That's when the date's not being extracted from the database in the first place!

datetime used to use the database to do all its date stuff.  But much of the code there is used to build datetime widgets, like the one that displays all the days of the month in calendar format.  You don't need the database to do that, just as you don't need the database in order to add two Tcl vars together.

The time to do date formatting in the database is during the query that extracts the date(s).  You should always do this if possible.  If you can't do that, though, or if the database isn't involved ("Next Month" isn't stored in a databsae table, it is calculated based on today's date), then using the dt_* utilities is the right thing to do.