Forums

This topic is locked

How to insert the date using php_mysql into MySQL?

Posted 11 Feb 2003 12:21:51
1
has voted
11 Feb 2003 12:21:51 Terry Lau posted:
How to insert the current the date and time such as format
MM-DD-YYYY HH:mm:ss into MySQL using PHP_MySQL in Dreamweaver?
Do I need to write PHP code myself ? If yes, how?
THANKS!!

Replies

Replied 11 Feb 2003 16:12:55
11 Feb 2003 16:12:55 Brent Colflesh replied:
Dear Mufcterry,
Take a look here:

www.mysql.com/doc/en/DATETIME.html

Regards,
Brent

Replied 12 Feb 2003 10:22:35
12 Feb 2003 10:22:35 Iain Stewart replied:
Hi,

the way i do it is, use a timestamp in the table that way when the db is updated the time date is put in for you, then to diplay it on your page use

Date_Fornat() in your sql statement.
You will need to go to advanced in you querry. and use something like

SELECT colA,colB,colC,DATE_FORMAT(colDate,'%d-%m-%Y %T')
From.....

there are various %d-%m-%y you can use to display the date, weither you want month in name or number etc look at

www.mysql.com/doc/en/Date_and_time_functions.html

hope this helps

Iain

head hurts, 'mental note to self, stop banging head !'

Reply to this topic