Prev | Chapter 12. Engineering Standards | Next

## Variables

### Date and Time Variables

($Id: variables.html,v 1.23.2.3 2007/07/14 12:34:48 donb Exp $)

By joel@aufrecht.org

OpenACS docs are written by the named authors, and may be edited by OpenACS documentation staff.

Starting with OpenACS 5.0 and the introduction of acs-lang, we recommend retrieving date/time information from the database in ANSI format and then using lc_time_fmt to format it for display.

Example 12.1. Getting datetime from the database ANSI-style

    db_multirow -extend { mydate_pretty } {
        select to_char(mydate, 'YYYY-MM-DD HH24:MI:SS') as mydate_ansi,
              ...
        ...
    } {
        set mydate_ansi [lc_time_system_to_conn $mydate_ansi]
        set mydate_pretty [lc_time_fmt $mydate_ansi "%x %X"]
    }

Prev | Home | Next
PL/SQL Standards | Up | Automated Testing

View comments on this page at openacs.org