lukedubauskas Posted April 18, 2010 Share Posted April 18, 2010 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 More sharing options...
Rustywolf Posted April 18, 2010 Share Posted April 18, 2010 Add this near the beggining of your script date_default_timezone_set('Australia/Sydney');[/php Link to comment https://forums.phpfreaks.com/topic/198961-timezone-adding-8-hours-to-a-date-field/#findComment-1044358 Share on other sites More sharing options...
lukedubauskas Posted April 19, 2010 Author Share Posted April 19, 2010 Add this near the beggining of your script date_default_timezone_set('Australia/Sydney');[/php Thanks for your help, much appreciated. Will try as you suggested. Cheers. Link to comment https://forums.phpfreaks.com/topic/198961-timezone-adding-8-hours-to-a-date-field/#findComment-1044461 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.