glenelkins Posted June 14, 2006 Share Posted June 14, 2006 HiOk i use an open source popup calendar to input the date into a text box, it uses the format mm/dd/yyyyI would like to convert this to mm-dd-yyyy so its accepted in the database, cant remember how to do this can anyone help quickly plz Quote Link to comment https://forums.phpfreaks.com/topic/11956-change-date-format-from-inputted-date/ Share on other sites More sharing options...
joquius Posted June 14, 2006 Share Posted June 14, 2006 how are you inserting this date into the DB? from that textbox? Quote Link to comment https://forums.phpfreaks.com/topic/11956-change-date-format-from-inputted-date/#findComment-45403 Share on other sites More sharing options...
glenelkins Posted June 14, 2006 Author Share Posted June 14, 2006 yeh and as the database takes yyyy-mm-dd (sorry i typed it wrong last time) i need to convert from DD-MM-YYYY sorry i put the wrong formats completely before Quote Link to comment https://forums.phpfreaks.com/topic/11956-change-date-format-from-inputted-date/#findComment-45408 Share on other sites More sharing options...
AndyB Posted June 14, 2006 Share Posted June 14, 2006 [code]list($d,$m,$y) = explode("-",$old_date);$new_date = date("Y-m-d",mktime(0,0,0,$m,$d,$y));[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11956-change-date-format-from-inputted-date/#findComment-45449 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.