Hi,
Currently I have two colomns as frm_date and to_date.
I need to display two dates in a one column as frm_date - to_date.
eg: 2007-01-01 - 2009-01-01.

Is there any functon to do this?
Thanks in advance!!

Recommended Answers

All 2 Replies

SELECT concat(date_format(frm_dt,'%d-%m-%Y'),' - ',date_format(to_dt,'%d-%m-%Y'))  period FROM `tablename`

or

SELECT concat(frm_dt,' - ',to_dt)  FROM `tablename`

Or instead of concatenating, do this in your programming language which handles the web page layout, probably PHP. This gives you a bit more control as you can then do things with the individual dates, but still display then on the page the way you want.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.