Jump to content

Setting a different start and end date to a year....


mkosmosports

Recommended Posts

Hey all,

Im working on a soccer site and I want php to dynamically produce the current year as part of a URL variable when they look at data from a specific season. Easy enough right:

                  $thisyear=date('Y');
                  echo("<li><a href=\"leaguehome.html?group=1&season=$thisyear\">Premiership</a></li>

The problem is, because a soccer season lies over two years, when 2007 rolls around and the season variable will equal 2007, the mysql query would try to get data from the 2007 season, which isnt there yet.
I would need a small php function which would for example tell 2006 to run from Aug. 2006 to July 2007 as opposed to Jan.2006 to Dec.2006, so that when the $thisyear variable stays at 2006 until July 2007 when it would change over to 2007.....

I know I maybe be confusing to read (php beginner) but if someone understands what I mean, I would appreciate any help or advice...

Thanks!

mkosmosports
Link to comment
Share on other sites

Hey Orio,

Thanks for the response...

Using your below code I now have

                  <?php
  $newseason=strtotime("+6 months");
  date("Y", $newseason);
                  echo("<li><a href=\"leaguehome.html?group=1&season=$newseason\">English Premiership</a></li>
                  ?>

However, the $newseason variable returns wild numbers like 1167347827, etc. Any ideas why?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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