Jump to content

[SOLVED] date_FORMAT Need to convert back to MySQL Date Format


Recommended Posts

Below is a couple of snippets of code that I have for modifying the date format from MySQL and it works great.  The problem I am running into is later in the code I need to call the $AuctionDate variable to query the data field in another table.  This won't work because the format has been modified using date_FORMAT.  How do I convert it back to the MySQL date format so I can properly query the database.  Thank for your help as usual!

 

Query converting MySQL date format:

$query="SELECT date_FORMAT(AuctionDate, '%M %e, %Y') as newdate, AuctionDescription, AuctionTitle FROM auctions WHERE AuctionDate >= NOW() ORDER BY AuctionDate"; 

$AuctionDate=mysql_result($result,$i,"newdate");

 

Need to change $AuctionDate back to MySQL date format for the query below:

$query="SELECT AuctionImageDate FROM AuctionImages WHERE AuctionImageDate=$AuctionData"; 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.