Jump to content

Timezone - Adding 8 hours to a date field


lukedubauskas

Recommended Posts

Hi there

 

I am having troubles adjusting my code to allow for a different time zone. My client's site is in Australia but the mysql server is in the Netherlands, which is 8 hours behind. Each day they want to display which users birthdays is on the current date which is working fine, I just need help adding the extra 8 hours to make up the time difference.

 

Here is my code, thanks in advance for your help.

 

<?php

mysql_select_db($database_ambassador_db, $ambassador_db);

$query_rs_tbl_birthdays = "SELECT real_name FROM tbl_ambassadors WHERE dob = CURDATE() ORDER BY real_name ASC";

$rs_tbl_birthdays = mysql_query($query_rs_tbl_birthdays, $ambassador_db) or die(mysql_error());

$row_rs_tbl_birthdays = mysql_fetch_assoc($rs_tbl_birthdays);

$totalRows_rs_tbl_birthdays = mysql_num_rows($rs_tbl_birthdays);

?>

 

<div class="text_side_panels" id="holder_birthdays">

  <?php do { ?>

 

  <?php echo $row_rs_tbl_birthdays['real_name']; ?>

 

  <?php if ($totalRows_rs_tbl_birthdays == 0) { // Show if recordset empty ?>

  <?php echo "No Ambassador birthdays today" ?>

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

<br />

 

    <?php } while ($row_rs_tbl_birthdays = mysql_fetch_assoc($rs_tbl_birthdays)); ?>

  <br />

      </div>

<?php

mysql_free_result($rs_tbl_birthdays);

?>

 

Link to comment
https://forums.phpfreaks.com/topic/198961-timezone-adding-8-hours-to-a-date-field/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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