Support Forums

Full Version: Time added to database
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

Is it possible to fetch the time that a form was submitted to the database? When I submit my form to my database, it displays in a table - is it possible to display the time that it was added?

Let me know if I need to explain more.

Thanks
Yes it is!
In your table you need to create an extra field, type "DATE" or "DATETIME" or "TIMESTAMP"
If you use time stamp you can create a field with this command
Code:
`update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,

The entry would look like, update_time = 2009-12-31 00:55:55

Or you can also use a PHP function "date()"

PHP Code:
$stamp date("Y.d.m H:i:s"); // TYPE: DATETIME
$stamp date("Y.d.m"); // TYPE: DATE
$stamp date("H:i:s"); // TYPE: TIME 

And just pass the $stamp along with other variables to your DB.