English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how do i record the time and date in sql tables
the zeros aint moving 0000-00-00-00:00:00

am using the DATETIME function, i know theres a zillion ways, i just want one that does the job..

2007-01-08 11:19:06 · 2 answers · asked by g_playa_gent 1 in Computers & Internet Programming & Design

2 answers

INSERT INTO table (recorded) VALUES (now());

This should work in MySQL. In Oracle you might want to use something like SYSDATE.
Is that what you wanted?

PS. It looks like SYSDATE() will also work in MySQL.

2007-01-08 11:46:07 · answer #1 · answered by FXJKHR 3 · 0 0

The easiest way is to use SYSDATE. That will give you the current date and time down to seconds. Using TIMESTAMP can get it down to 9 decimal places of seconds.

Just, if you are updating, use SET datetime_col = SYSDATE.

2007-01-10 15:38:39 · answer #2 · answered by Elizabeth Howard 6 · 0 0

fedest.com, questions and answers