Jump to content

Date changing prematurely


hard2learn

Recommended Posts

My question probably won't get answered because really even though I am putting the effort in I just don't get this. I inherited a hockey website that is PHP / mysql. I have learnt to update, a bit of php but nothing like you people I see here.

 

Here is my problem. There is a next game section. It grabs the info from the schedule in the database. The problem is it changes to the "next" game early on game day so everone that looks at the site on the day of the game doesn't get the actual next game which is that night. I am sorry as I am not even sure what info I would need to give you geniuses. I will attach some coding and see if that helps.

 

- Also how would I code for a BOLD "TONIGHT" to show on either a home or away game the day of the game if possible?

- I sure appreciate any help. I can get more info if needed.

 

Thanks...John

 

 

            <?php } // Show if recordset not empty ?>

            <?php if ($totalRows_awayGames > 0) { // Show if recordset not empty ?>

    <div class="game">

<h2>Next Away Game<a href="schedule.php">schedule ></a></h2>

 

<div class="gameSched">

<?php resizepic(70, 70, "images/team_logos/","griz.gif", "VC", "photo"); ?> vs <?php resizepic(70, 70, "images/team_logos/",$row_awayGames['teamLogo'], $row_awayGames['teamCity'], "photo"); ?>

<p><?php echo $row_awayGames['gameTime']; ?></p>

<p><?php echo date('l, F d, Y',strtotime($row_awayGames['gameDate'])); ?></p>

<p><?php echo $row_awayGames['location']; ?></p>

</div>

</div>

            <?php } // Show if recordset not empty ?>

 

Link to comment
Share on other sites

Any date conversion in php, using the date() function adjusts the date to the time zone the server is in.

 

If the dates and times are stored in the mysql database using standard mysql DATE or DATETIME data types (and if they are not stored this way you should consider changing them so that they are), you can format them directly in the SELECT query using the mysql DATE_FORMAT() function.

 

If you still want to use the php date() function, you need to set the time zone you want to use in your php script before the date() function is called.

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.