Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.