Hi all, just wondering what the best way is to structure time in sql database. For example, at present i use this format ; 19/08/2011 (which is day/month/year). when i call this in a sql statement, it shows all results, but not in a chronological order. Can any body solve this?

Cheers lovely people

Recommended Answers

All 3 Replies

You need to sort the result set using Order by on the date column in your SQL.


select * From employee order by date_of_join

I have a sort on my statement already though bud, but it sorts on the first numbers first. I need it to sort in a chronological order. at present it sorts days regardless of the month eg:


that means you have not stored your date using "date" datatype, you might be using varchar datatype.

So in short change datatype to "date" of that column

Be a part of the DaniWeb community

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