Forum Moderators: coopster

Message Too Old, No Replies

datetime

         

kristof_v

11:19 am on Dec 1, 2006 (gmt 0)

10+ Year Member



I show the current datetime in a textfield like this:

<input type="text" name="date" value="<?php echo date('D M j G:i:s Y');?>" size="25" />

now i want to save that date in mysql, but i don't know how to format the $_POST['date'] value to put in the datetime field in mysql

eelixduppy

11:56 am on Dec 1, 2006 (gmt 0)




The DATETIME type is used when you need values that contain both date and time information. MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'.

[dev.mysql.com...]

If it fits into what you are trying to do, then a TIMESTAMP seems like a better solution. Refer to link for more info.

kristof_v

2:46 pm on Dec 1, 2006 (gmt 0)

10+ Year Member



ok thx!