pwnuspoints Posted December 10, 2009 Share Posted December 10, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/184704-julian-day-number-range/ Share on other sites More sharing options...
.josh Posted December 11, 2009 Share Posted December 11, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/184704-julian-day-number-range/#findComment-975190 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.