Date extracting function in SQL

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vcodeinfotec
Forum Newbie
Posts: 10
Joined: Sat Jul 12, 2008 2:08 am

Date extracting function in SQL

Post by vcodeinfotec »

Hello,

Can anyone help me!!!

2008-07-06 16:46:15
2008-07-06 16:47:44
2008-07-06 10:18:25
2008-07-24 14:38:25
If these are the records in a table i need to get the output like this:

2008-07-06
2008-07-24

Please help
sureshmaharana
Forum Commoner
Posts: 30
Joined: Thu Jul 03, 2008 4:20 am
Contact:

Re: Date extracting function in SQL

Post by sureshmaharana »

Try this:

SELECT date_format( Date, '%Y-%m-%d' ) AS date
FROM table name

where Date is your table's field name.
Post Reply