avo Posted July 2, 2006 Share Posted July 2, 2006 Hi all Nice new site!! I LIKE IT !!. ;DCan anyone please help me out here i have a date coloum in mysql db once ive entered a date in the sql what would be the best way to get this date out and reformated to a uk date DD-MM-YYYY i was trying this but for some reson it misses the year out when i echo [quote]<input name="txt_con_expiry" type="text" id="txt_con_expiry" value="<? $tempdate=explode("-", $txt_con_expiry); echo $tempdate[3]; echo $tempdate[2]; echo $tempdate[1];?> " />[/quote] $txt_con_expiry is a variable set when it is SELECTED FROM MY DB Any ideas please Link to comment https://forums.phpfreaks.com/topic/13468-get-date-from-mysql-date-coloum-formated-correct/ Share on other sites More sharing options...
Orio Posted July 2, 2006 Share Posted July 2, 2006 In what way is it stored in db? Timestamp? Other format?Orio. Link to comment https://forums.phpfreaks.com/topic/13468-get-date-from-mysql-date-coloum-formated-correct/#findComment-52051 Share on other sites More sharing options...
avo Posted July 2, 2006 Author Share Posted July 2, 2006 Hi When its entered into the db yes im using timestamp formated when it goes in as YYYY-MM-DD Link to comment https://forums.phpfreaks.com/topic/13468-get-date-from-mysql-date-coloum-formated-correct/#findComment-52055 Share on other sites More sharing options...
Orio Posted July 2, 2006 Share Posted July 2, 2006 [code=php:0]//$db_date is the date in db//$format is after we change the order. $arr=explode("-",$db_date);$format=$arr[2]."-".$arr[1]."-".$arr[0];[/code][hr]This is what you wanted??Orio. Link to comment https://forums.phpfreaks.com/topic/13468-get-date-from-mysql-date-coloum-formated-correct/#findComment-52064 Share on other sites More sharing options...
avo Posted July 2, 2006 Author Share Posted July 2, 2006 HI Thanks How did i forget about counts starting at zero not 1 KICKING MYSELF !!!!Thanks Help Greatly Appriciated Link to comment https://forums.phpfreaks.com/topic/13468-get-date-from-mysql-date-coloum-formated-correct/#findComment-52067 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.