in reply to Sorting Question

... I am left with a problem trying to sort trough the values for displaying the data, since it's stored in different fields in the data base.

Assuming you're using a SQL database, this is what the ORDER BY clause in SELECT queries is for. Something like

ORDER BY year, month, day

might work for you.