We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Getting the Day Part of my DATE Field in Mysql PHP

Campbellh
Campbellh asked
on
Medium Priority
306 Views
Last Modified: 2012-05-06
Hello Guys

I have a date field in my mysql database, I would like to get the Day Part

eg I have 12/02/2009  and i would just like to get  February 12 from it.

Thanks for any help
$row['DOB']

Open in new window

Comment
Watch Question

Guy Hengel [angelIII / a3]Billing Engineer
CERTIFIED EXPERT
Most Valuable Expert 2014
Top Expert 2009

Commented:
you should modify the query to return a field with date value, using DATE_FORMAT() function:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format
LAMP Developer
CERTIFIED EXPERT
Commented:
It is very simple, just modify your sql where you retrieve.


SELECT DATE_FORMAT(db_date_field, '%M %d');

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.