Forum OpenACS Q&A: Response to Globalization

Collapse
14: Response to Globalization (response to 1)
Posted by Tilmann Singer on
Lars,

propably moving the formatting into the webserver level is the only way. I think the argument Jonathan brings up against the inefficiency of formatting the timestamps in the webserver can be consolidated by selecting the timestamp in epoch format from the database (select date_part('epoch', some_date) as some_date ...), because this can be fed directly to the tcl clock command without extra parsing overhead.

The only further drawback of this that I can think of is that one would have to do some extra typing in the tcl pages, but maybe this approach is the one with the least effort. For example a multirow would look like this:

db_multirow dates dates {
  select date_part('epoch', some_date) as some_date from foo ...
} {
  set some_date_pretty [dt_short $some_date]
}

Some typing could be saved by defining a dt_epoch(timestamp) plsql function.

And yes, it would be a lot easier to do fancy stuff like return "Yesterday", or "2 hours ago". The procs could have a -fancy_p switch for that.