Jump to content

change server time to local time...


ManInBlack

Recommended Posts

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

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

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.