jpgalea Posted November 24, 2008 Report Share Posted November 24, 2008 hi how can i change the date of the server? thanks Quote Link to comment Share on other sites More sharing options...
jpgalea Posted November 24, 2008 Author Report Share Posted November 24, 2008 any help on this pls? Quote Link to comment Share on other sites More sharing options...
Ric Posted November 25, 2008 Report Share Posted November 25, 2008 You never explained why you want to do this. Apache obtains its time reference from the PC clock. In theory you could change the PC clock hence change Apache time. It is neither desirable nor a good idea to do this, will cause havoc with other programs. If all you want to do is change-displayed time to a user use PHP for example:Save this as test.php it effectively locates your server in a different time zone, however in reality it is referenced to your PC time. <p>Display local time</p> <?php print date("H:i") ?> <p>Display time difference + 5hours</p> <?php $diff_to_localtime=5; $new_var=date("U")+$diff_to_localtime*3600; print date("H:i", $new_var); ?> <p>Display time difference - 5hours</p> <?php $diff_to_localtime=5; $new_var=date("U")-$diff_to_localtime*3600; print date("H:i", $new_var); ?> <?php putenv("TZ=America/Chicago"); ?> <p>Display local time America/Chicago </p> <?php print date("H:i") ?> <br> <?php putenv("TZ=Australia/Melbourne"); ?> <p>Display local time Australia/Melbourne</p> <?php print date("H:i") ?> <br> If you want to do is echo their local time use a small JavaScript to pick up there local PC time. Not sure if that’s of any helpAll the bestRic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.