Jump to content

4bidden

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

4bidden's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Maybe I should simplify what I'm asking.... I am getting a variable such as January 24-27, 2006 fed to me from mySQL, but sometimes I will need to subtract one day from the end making it January 24-26, 2006. I also have available to me the start date and end date in datetime format such as 2006-01-24 00:00:00. How about this. How can I do math on two dates formatted in mysql datetime in PHP?
  2. Here is the situation. I have a mySQL database that has a starttime field (datetime), endtime field (datetime), coursecode field (GPR4 for example) and a nice pretty field that has the dates already formatted like December 28-30, 2006. The database is a listing of all available events occuring at our facility. I am displaying the available dates on the web. I figured I'd make it easy on myself and use the pre-formatted field BUT I forgot something. We have a course called GPR3 and GPR4 (the 3 and 4 refering to a 3 and 4 day course). The GPR3 dates are all GPR3 and GPR4 dates (they just do the first 3 days). So when I select all the info with rows containing both coursecodes, the nice and pretty pre-formatted column still shows the course running 4 days. So my output is looking like this. Available GPR3 dates: May 22-25, 2006 June 5-8, 2006 June 19-22, 2006 June 26-28, 2006 July 5-7, 2006 July 10-13, 2006 As you can see, most of the dates are GPR4 dates and therefore show the course running 4 days. So how should I go about fixing this. The startdate field returns format YYYY-MM-DD 00:00:00. The logic basically needs to go if(enddate - startdate > 3) { enddate--; } And then I can work with it from there. I'm just lost as to what transformations (and how) to do on the datetime format from sql to get there. Thanks in advance for all help!!!
×
×
  • 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.