Forum OpenACS Q&A: Accessing the system clock

Posted by Andrew Zeon on

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


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

Posted by David Walker on
ns_write [ns_fmttime [clock seconds]]
ns_write [clock format [clock seconds] ]
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!

Posted by Andrew Piskorski on