scriptygoddess RSS Feed
 
 
 
 

Getting Dates in mySQL with MIN() and MAX()

I'm working on a plugin that required getting the earliest date in the database, and also getting the oldest date in the database. I was hoping that there was a built-in function that did this - and there is. :)

I found this helpful article on various mySQL techniques. And this is the one I was going to use:

MIN() will return the earliest date, while MAX() returns the latest date.

So the mySQL statement will look something like this:

SELECT MIN(DateFieldName) FROM TableName

One Response to “Getting Dates in mySQL with MIN() and MAX()”

  1. 1
    JM:

    That was weird. I was just following top100 blogroll links to find new stuff to read, and I find a link to something I wrote. Did you need help with something? Just holler.

Bookmarks

WordPress Resources

Meta

Random Stuff