ManInBlack Posted September 1, 2009 Share Posted September 1, 2009 Hi. I need some code for change server time to local time... This is my code... $result = mysql_query("SELECT flokkur,dagstimi,texti FROM tenglar ORDER BY dagstimi DESC"); $currentDate =''; $dagur = date("Y-m-d H-i"); while ($row = mysql_fetch_assoc($result)) { if ($dagur > $row['dagstimi']) { if ($currentDate != $row['dagstimi']) { echo '<div class="dagsetning">'.$row['dagstimi'].'</div>'; $currentDate = $row['dagstimi']; } echo "<div class='tenglalisti'><img src='img/arrow.gif' width='8' height='8' /> "; echo $row['flokkur']; echo $row['texti']; echo "<br /> </div>"; Link to comment https://forums.phpfreaks.com/topic/172735-change-server-time-to-local-time/ Share on other sites More sharing options...
waynew Posted September 1, 2009 Share Posted September 1, 2009 Think about this first. If you're using a MySQL function to update those columns, it could throw your script off if you change the timezone of the script. If you're creating the date in your script and then inserting it into PHP, you'll also have to change the timezone of the script that inserts it. Read this: http://www.phpfreaks.com/tutorial/working-with-dates-in-php Link to comment https://forums.phpfreaks.com/topic/172735-change-server-time-to-local-time/#findComment-910522 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.