If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > how to grab datetime and enter it into a form to be submitted to a MySQL Database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-11-05, 17:27
purpendicular purpendicular is offline
Registered User
 
Join Date: Mar 2004
Location: Rhode Island, USA
Posts: 55
how to grab datetime and enter it into a form to be submitted to a MySQL Database

I'm trying to set up a database that tracks system downtimes.
I would like to have a date and time stamp auto insert into a form field so that it can be used as a key field, this will also serve as the incident identifier for lookup purposes. Keeping the date in the format MySQL likes is fine with me.
I am using Dreamweaver MX 2004 and am fairly new to both DW And MySQL.
Any help, suggestions or points in the right direction would be appreciated.
Thanks,
Ray
Attached Images
File Type: jpg web.JPG (11.4 KB, 177 views)
Reply With Quote
  #2 (permalink)  
Old 01-11-05, 20:46
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
why not let the INSERT statement provide a datetime value at the moment it is entered into the database

then you won't need a form field at all

by the way, it is more common practice in these situations to use an auto_increment number as the identifier
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-17-05, 11:18
the_spas the_spas is offline
Registered User
 
Join Date: Jan 2005
Posts: 10
but if you realy want to add a datetime to mysql do it this way

the string should have this format
"YYYY-MM-DD HH:MMS"
for example "2005-01-17 17:18:31"

otherwise just use NOW() in the insert statement
something like this
INSERT INTO mytable VALUES ( ....., NOW(), ....)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On