Forum Moderators: coopster

Message Too Old, No Replies

help with strtotime function

need help figuring out beginning of week

         

iluvthsgam

10:42 pm on Nov 19, 2008 (gmt 0)

10+ Year Member



I have a function that reads an iCal .ics file for event dates. I want to display the dates on my website - but I only want to display the dates for this week and the next week - I have to put a start time and end time on the iCal function (in the unix timestamp format).

Here is what I need to do. Check for the current day. For example, say today is Wednesday. I need to then calculate the date for the previous Monday. My week runs from Monday - Sunday.

Then I can say the start date for the iCal function is on that Monday.

Then I need to say that okay, if today is Wed then the end date will not be this upcoming Sunday, but NEXT Sunday. That way I can say the end day is the second Sunday away.

Have been trying all day but can't get it working. Any thoughts?

Thanks!

iluvthsgam

11:12 pm on Nov 19, 2008 (gmt 0)

10+ Year Member



Okay I am making a little progress but this is troubling me.

I used the following code:

$endDate = strtotime("+2 Sundays, 9pm", "1222833600");

And it spits out the correct Sunday, but at 11pm not 9pm. If I move it to 11pm in the strtotime function it spits out the following monday at 1am.

Anyone know why ?

cameraman

1:21 am on Nov 20, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World, iluvthsgam.

It probably has to do with your time zone. Here, it's spitting out 8:00 pm.

iluvthsgam

2:10 am on Nov 20, 2008 (gmt 0)

10+ Year Member



that was the problem. Thanks!