...

View Full Version : How to convert uk date to mysql date format



che_anj
08-30-2007, 11:38 AM
Hello,

anyone knows how to convert uk date to mysql date format? I have 3 textboxes having the values of dates.

the format are the following:

textbox1-29/08/2007
textbox2-14/08/2007
textbox3-20/08/2007

upon entering it into the database the following dates should be converted already to the mysql date format like 2007-08-29


tnx...

abduraooft
08-30-2007, 11:48 AM
Are you looking for something like str_to_date (http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_str-to-date)

che_anj
08-30-2007, 12:08 PM
the date is not yet entered in the database.. It must be converted first to mysql date format before saving it..

abduraooft
08-30-2007, 12:28 PM
insert into table_name(field) values (STR_TO_DATE('08/25/2007', '%m/%d/%Y'))

che_anj
08-30-2007, 01:36 PM
can u give me an example?

i try but it displays 1970-01-01

$start=$_POST['startdate'];
echo date('Y-m-d',$start);

Nightfire
08-30-2007, 04:17 PM
The example is above. Nowhere in the example shown is the date function



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum