Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2004, 10:45 PM
amorphic8's Avatar
WebProWorld Member
 

Join Date: Oct 2003
Location: San Jose
Posts: 69
amorphic8 RepRank 0
Default PHP to mySQL date format conversion

I am newbie to PHP/mySQL but have managed to make some headway using various books on the subject. I am trying to make a form page that my clients can access to update the 'events' table in thier site's database.

I have created the database using phpMyAdmin, no problem. I have connected to it, sorted the results of the queries and formatted the data into a nice HTML table etc... works fine.

Now I am trying to create a form that puts the event information into the database.

I am having a problem getting the date info in the correct format. I want the date information to be entered via a dropdown menu (month, day, year) generated by php on the addEvent.php page.

I am getting each of the month, day and year as separate values:
$month (01-12)
$day (01-31)
$year (2004-2014);

how can I combine these variables into a format that I can pop into the DB, then query, sort, and format as a date type with mySQL?
__________________
amorphic8
http://www.amorphicmedia.com
Reply With Quote
  #2 (permalink)  
Old 01-18-2004, 11:04 PM
redcircle's Avatar
WebProWorld Veteran
 

Join Date: Aug 2003
Location: Grand Rapids, MI USA
Posts: 553
redcircle RepRank 0
Default

The manual is your friend.

www.php.net/mktime - this will create a unix timstamp.

I usually just store the timestamp within the database as a bigint then I can use the date() function to do whatever I want with it.
__________________
www.squitosoft.com - PHP development site. featuring Squito Gallery. a php driven photo gallery.
www.rgfx.net - Specializing in Internet solutions, including Html authoring, Interactive Web sites, 3D/2D Graphics and animation.
Reply With Quote
  #3 (permalink)  
Old 01-19-2004, 01:28 AM
amorphic8's Avatar
WebProWorld Member
 

Join Date: Oct 2003
Location: San Jose
Posts: 69
amorphic8 RepRank 0
Default

Thanks.

I have been buried in PHP/mySQL books, bibles, etc... and never even considered 'the Manual.'

I scanned the link you sent and it looks like what I need. I will try it tomorrow afternoon.
__________________
amorphic8
http://www.amorphicmedia.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: , , , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0