View Single Post

  #8 (permalink)  
Old 27-02-2008, 01:01 PM
Frodo's Avatar
Frodo Frodo is offline
Ciaran Rooney - Weeno Ltd
 
Join Date: Jan 2007
Location: London
Posts: 359
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

Quote:
Originally Posted by ziycon View Post
I have had a go but i can't figure out how to take the dates from the record and the work with them, there all in the YYYY-MM-DD format.
Did you try that query it extracts the date as month, year in fact it does exactly what you asked for.

MySQL has some very powerful date functions see the link Briask posted. Its much better to do all your date formating in your sql queries then in the PHP.

YYYY-DD-MM HH:MM:SS is the standard format for storing dates and is widely used avoids all that American vs European dates but the are other ways it can be stored, using the mysql date function in your query means you will always get the date format in the same way regardless of how it is stored in the db and then you won't break your php apps if it changes due to an update or changing the db.

Imagin if your converting all the dates you got from queries to unix format in your php and for some reason the date field in your db is shange to store them in unix time. What happens when you convert a unix time stamp to a unix time stamp.
__________________
PHP Code:
print "CEO Weeno Ltd   - http://www.weeno.ie";
print 
"CTO Skimbit Ltd - http://skimbit.com"
skimlinks.com :: Outsource your affiliate marketing and generate revenue from your content easily.
Reply With Quote