Jump to content

Julian Day Number Range.


pwnuspoints

Recommended Posts

Hello phpfreaks!

 

As always any help is appreciated!

 

I am currently using an installation of Easy PHP Calendar <http://www.easyphpcalendar.com/> on my website to keep track of important dates and events.

 

As one might imagine Easy PHP Calendar makes use of PHP/SQL functionality to store important dates in a database on my server. When I use the Easy PHP Calendar web interface to add an event it stores the information I input into a table called 'epc_calendar'. This table is actually pretty straight forward; it's column headers are as follows: id, startDate, endDate, startTime, endTime, eventType, repeatx, title, descr, days, stop, month, weekDay, weekNumber, category, eventKey.

 

The only columns from 'epc_calendar' I need to be concerned with are startDate and category. The startDate column stores the start date of each event as a Julian Day Number [e.g. "12/10/2009" = " 2455176"]. The category column stores a VARCHAR numbered string which associates a highlight color to each event when displayed [e.g. "0[2X" = "Blue"].

 

Okay, so here's the challenge.

 

I want to display a list of four or five of the most recent upcoming events using this database. To accomplish this I need to write an SQL query which is aware of the current date in Julian Day format and searches for any events from the current day on. I also need to further define the query by only showing items of a certain category.

 

Did you get all that? Because my head is spinning.

 

Summed up.. I need to select a range of dates stored in my database in Julian Day format.

 

Thanks in advance for any help you offer!

Link to comment
https://forums.phpfreaks.com/topic/184704-julian-day-number-range/
Share on other sites

i don't know offhand if there's a built-in function for converting julian date to something else though looking at wiki it looks fairly easy to write a function to convert it yourself.  As far as selecting it from the db to begin with: looks like from wikipedia it works more or less same principle as a unix timestamp, as in, greater number == more recent date.  So you could easily select x limit 5 desc

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.