Jump to content

[SOLVED] Calendars


rxbanditboy1112

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/41873-solved-calendars/
Share on other sites

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?

Link to comment
https://forums.phpfreaks.com/topic/41873-solved-calendars/#findComment-203035
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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