RE: php date function

Author: Virgil Bierschwale

Posted: 2013-09-27 at 11:06:06

It will be something along these lines:

$day = date("l");

If (($day >=date("I")) or ($day <=date("I")))

W3schools.com is your friend.

http://w3schools.com/php/php_date.asp

for what it's worth, I had a hard time with it as well, and php gets

confusing when you have php, html, etc. mixed together along with whatever

else wordpress throws in.

I've got a problem at kaaw now where wordpress uses zulu time and I've

written my code to display a different header each day.

It's a problem because it changes about 7PM here in texas rather than

midnight, but for now I will live with it as I'm behind in my accounting

classes and class ends this weekend.

-----Original Message-----

From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Gary Jeurink

Sent: Friday, September 27, 2013 10:58 AM

To: 'ProFox Email List'

Subject: RE: php date function

I struggle because I'm not good with the date data type. My first failure

was to count the weeks between the start date and the current date and I

failed. Then I built a PHP switch trap with current date falling between two

dates or after being post season, would be perfect. When I hover on the ESPN

week selector, it reveals the two dates.

How do I code an IF current date between date1 and date2?

The difference between college and pro is a separate problem that I think I

can handle. ... I like your solution and am googling for a between dates php

solution.

Gary

-----Original Message-----

From: Virgil Bierschwale [mailto:vbiersch@gmail.com]

Sent: Tuesday, September 24, 2013 1:18 PM

To: 'ProFox Email List'

Subject: RE: php date function

Here is some code I use for changing video's each day

Should be self explanatory, but if not, give me a shout

<?php

//Give what day of the week it is. Returns Sunday through Saturday.

$day = date("l");

if ($day == "Monday")

{

// Clint Eastwood

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

// Gomer Pyle

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

}

elseif ($day == "Tuesday")

{

// College Girl

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/j6iqTHJHW5o?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

// Clint Eastwood

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

}

elseif ($day == "Wednesday")

{

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

}

elseif ($day == "Thursday")

{

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

}

elseif ($day == "Friday")

{

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

}

elseif ($day == "Saturday")

{

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/tFAiqxm1FDA" frameborder="0"

allowfullscreen></iframe>';

}

elseif ($day == "Sunday")

{

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/r5KeGccP9Jk?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

echo '<iframe width="510" height="315"

src="http://www.youtube.com/embed/1sJl5OC7LCU?feature=player_embedded"

frameborder="0" allowfullscreen></iframe>';

}

?>

-----Original Message-----

From: ProFox [mailto:profox-bounces@leafe.com] On Behalf Of Gary Jeurink

Sent: Tuesday, September 24, 2013 1:09 PM

To: 'ProFox Email List'

Subject: php date function

Could somebody get me started on a PHP switch or IF ELSE function to set the

current week of a football season. Right now I am setting the date manually

each week with the following:

<?php

// function TO GET curweek of football season

function getCurWeek() {

$curWeek = '05';

return $curWeek;

} // end of getCurWeek

?>

Ideally I want to test the current date if it's between the start and end

date of each week. The wrinkle is and I need to adjust somehow, the pro

season is 1-week behind the college season and anything past curweek['15']

will be 'PS' post season for college and past curweek['17'] for pro's will

be 'PS' if you follow. I'll probably have to return two values instead of

the 1 that I'm doing now. I tried several and my php date syntax doesn't

work.

Gary Jeurink

--- StripMime Report -- processed MIME parts --- multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox

OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/079f01cebb9b$79ba98c0$6d2fca40$@gmail.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2013 Virgil Bierschwale