Welcome Guest, Not a member yet? Register   Sign In
Organising dates
#1

[eluser]richzilla[/eluser]
Hi All,

Im wanting to organize a series of dates in the following format. As a bit of context, the dates are the dates of upcoming events that can be added by my users. The format:

January 2011

date - event
date - event
date - event

February 2011

date - event
date - event
date - event

with all events in a given month, arranged by the date on which they occur. All of my event dates are stored in my database as unix timestamps. Problem is, i dotn know where id start to develop a function that would order all of my events in this way. Can anyone help me out?

Cheers
#2

[eluser]jedd[/eluser]
[quote author="ricardino" date="1274926179"]
All of my event dates are stored in my database as unix timestamps.
[/quote]

Do you mean the MySQL TIMESTAMP type? This stores as seconds since 1970-01-01T00:00:00.

Or have you used a large integer style column type? Are you even using MySQL?

This highlights the benefit of revealing more detail rather than less when asking questions.

If you have gone down the integer path, and you only want to show x months ahead (even for large values of x) then you could just calculate the month boundaries (in unix terms) for the next x months, and do a bunch of BETWEEN searches, then use php functions to convert them to the appropriate date format.

There's probably some other mysql / php magic - I'm not a very sophisticated user of dates in databases.




Theme © iAndrew 2016 - Forum software by © MyBB