Forums

PHP

This topic is locked

DATE field format with PHAkt & MX

Posted 18 Mar 2003 07:37:40
1
has voted
18 Mar 2003 07:37:40 dima alica posted:
Hi,

Im having DATE field in db with time. However, when I do simple SELECT all I get is yyyy-mm-dd filed format. There's seems to be no formatting option under Bindings menu.

Q: How can I format DATE field in selct statement so that it would show in yyyy-mm-dd hh:mi format?

Thanks

Replies

Replied 18 Mar 2003 10:08:13
18 Mar 2003 10:08:13 Iain Stewart replied:
I used Date_Format(Date_col,Format) as Date in my sql query, dont know if this is the best way but it seems to work for me

e.g

Select col1,col2,Date_Format(Date_col,'%D %M %Y') AS Date
From table1

I haven't used time but look at the mysql web site for more on DATE_FORMAT and you should find what you need.

hope this helps



Iain

head hurts, 'mental note to self, stop banging head !'
Replied 18 Mar 2003 14:02:51
18 Mar 2003 14:02:51 dima alica replied:
OK, thank you!

Reply to this topic