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!!!