| 
	
 | 
 Posted by Mickey on 03/12/07 19:32 
On Mar 12, 6:54 pm, Chris Hope <blackh...@electrictoolbox.com> wrote: 
 
> You don't need to convert it. If you have three variables, for example 
> $year, $month and $day, all you need to do is this: 
> 
> "INSERT INTO sometable (..., mydatefield) VALUES 
> (..., '$year-$month-$day')" 
> 
> There are better ways of doing this but at its most simple that will 
> work. Of course you need to be aware of sql injection if your values 
> come from a form post, and the $month and $day variables need to be 
> zero padded. 
> 
> To then utilise the database value from your SELECT query you can use 
> strtotime() to convert it to a timestamp and date() to format you as 
> you require, but there are limitations on the date range. You may be 
> better to use the database's date formatting functions to have it 
> formatted as you would like it displayed. 
> 
> -- 
> Chris Hope |www.electrictoolbox.com|www.linuxcdmall.com 
 
Thanks for the reply Chris. 
I also just found this which may be of help to someone else. 
 
Thanks again.
 
[Back to original message] 
 |