tripwater Posted June 6, 2008 Share Posted June 6, 2008 Hello, I am building a calendar that when you click on a date, it takes you to a form when you can create an event. From there you can make it a repeating event. My calendar is very much patterned after Google's calendar in how the process should work. The issue I am having now is that on a Monthly repeat I offer two choices "repeat on day of month" or "repeat on day of week". I have day of month working, which would be say the 5th of each month. But I am having a heck of a time figuring out the day of the week in this. I know there are functions out there for date("w", strtotime(date) ) but what I need is this: You click on a date, say 06/13/2008 and say you want it to repeat every 2 months. Well that is the second Friday of this month so I need my script to figure out 1. What day of the week are we one and is it the 1st, 2nd, 3rd 4th of the month 2. How to figure out what the 2nd Friday of each month is...then of course only insert for every 2 months if they selected 2 from the repeat every drop. It is possible they select every month or every 2 months or every 3 months all the way to 14. Again this is pretty much the same layout as Google calendar so if you have an account and go to the calendar screen and create a "detailed event" and select monthly from the repeat type, you will see the options and see how it reacts. I basically want to accomplish the same thing I just don't know how to do it using php date and time functions. Thank you for any help with this. Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/ Share on other sites More sharing options...
tapos Posted June 6, 2008 Share Posted June 6, 2008 why don't you use Google Calendar API for this type of application. http://code.google.com/apis/calendar/ Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/#findComment-559156 Share on other sites More sharing options...
tripwater Posted June 6, 2008 Author Share Posted June 6, 2008 because we are integrating this calendar into a web app that will hook into a CRM module as well as a PDM module. We need more versatitlity and total control over what DBs it is hooked to per user and what type of info they see. Most importantly we want control and complete understanding of the code. Thanks Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/#findComment-559239 Share on other sites More sharing options...
ingeva Posted June 6, 2008 Share Posted June 6, 2008 The getdate routine will return an array, and one of the entries is the weekday. Could that be a clue? Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/#findComment-559311 Share on other sites More sharing options...
tripwater Posted June 6, 2008 Author Share Posted June 6, 2008 Thanks for the reply..I can get the weekday by date("w") or date("N"), I need to know if it is the 1st second or third or fourth instance of it in that current month. In other words, I am on a Tuesday and I know I am on a Tuesday but is it the 1st Tuesday of the month or the second etc... Thank you again. Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/#findComment-559317 Share on other sites More sharing options...
ingeva Posted June 6, 2008 Share Posted June 6, 2008 Check the weekday of the first of the month. Link to comment https://forums.phpfreaks.com/topic/108985-help-with-date-script-on-day-of-week/#findComment-559319 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.