Forum OpenACS Q&A: Accessing the system clock

Collapse
Posted by Andrew Zeon on
Hi,

If I need to access the current time and date of the system, how
would I do that?

Thanks.

Collapse
Posted by defunct defunct on
If you just want a formatted data string you could use the tcl

clock format [clock clicks]

you can supply a -format option to have this information reported in whatever form you like.

just do a 'man clock' for full details

Collapse
Posted by David Walker on
ns_write [ns_fmttime [clock seconds]]
ns_write [clock format [clock seconds] ]
Collapse
Posted by Brian Fenton on
If I wanted to keep consistent times, I would you use my database as my clock.

In Oracle, you use the following:
select to_char(sysdate,'hh24:mi') as current_time from dual;

Related tip from bad experience: never change the OS time when the database is up. Ouch!

Collapse
Posted by Andrew Piskorski on