Jump to content


Photo

change date format from inputted date


  • Please log in to reply
3 replies to this topic

#1 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 14 June 2006 - 07:41 AM

Hi

Ok i use an open source popup calendar to input the date into a text box, it uses the format mm/dd/yyyy
I 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
http://thewebsolutionprovider.com - A Solution For Everything Web!

#2 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 14 June 2006 - 07:45 AM

how are you inserting this date into the DB? from that textbox?
z..z..z..z..z..z..z..z..

#3 glenelkins

glenelkins
  • Members
  • PipPipPip
  • Advanced Member
  • 760 posts
  • LocationBridlington - East Riding of Yorkshire - United Kingdom

Posted 14 June 2006 - 08:00 AM

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
http://thewebsolutionprovider.com - A Solution For Everything Web!

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 14 June 2006 - 10:56 AM

list($d,$m,$y) = explode("-",$old_date);
$new_date = date("Y-m-d",mktime(0,0,0,$m,$d,$y));

Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users