rxbanditboy1112 Posted March 8, 2007 Share Posted March 8, 2007 So I am working on a weekly calendar. For example users could enter in a date (via a date selection gui), and then post an event or something. That portion I am used to and fine with. Now to display a weekly calendar of events that is what i am wondering about. I know php has many date functions, but this is how i could see this working. I could make the first day displayed be today's date's events. Then the next day is this day $i++, till i have seven. Then i am thinking alright well how about if people want to go to the next week (by clicking next or previous). I was thinking alright i would save the i value, and then have it keep adding but limiting it to 7 adds per weekly display. What i am wondering is if i used $tomorrow = mktime(0, 0, 0, date("m") , date("d")+$i, date("Y")); could i just do that continuously without worrying about the month or the year? Does mktime automatically rollover? Has anyone had any experience with this, and has advice? Also does make time factor in leap years? Thanks Quote Link to comment Share on other sites More sharing options...
rxbanditboy1112 Posted March 8, 2007 Author Share Posted March 8, 2007 Actually i got it. According to the php manual. "mktime() is useful for doing date arithmetic and validation, as it will automatically calculate the correct value for out-of-range input. echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997)); should actually correct it's input to what is appropriate. Anyone have info about leap years? Quote Link to comment Share on other sites More sharing options...
rxbanditboy1112 Posted March 8, 2007 Author Share Posted March 8, 2007 Nvm hahah i got that tooo. I found other examples..... $lastday = mktime(0, 0, 0, 3, 0, 2000); echo strftime("Last day in Feb 2000 is: %d", $lastday); Should give you 29 Quote Link to comment 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.