Showing posts with label gmt time. Show all posts
Showing posts with label gmt time. Show all posts

Friday, March 28, 2014

Using php get GMT time by changing server timezone


<?php
date_default_timezone_set("UTC");
$timezone = date_default_timezone_get();
echo "Current server timezone: " . $timezone;
echo "<br/>Current server time: " . date("Y-m-d H:i:s", time());
?>

Friday, February 7, 2014

Get gmt time and gmt diferrence using jQuery


<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script>
    $(document).ready(function() {
        var rightNow = new Date();
        $("div").append("Local time: " + rightNow + "<br/>");
        var temp = rightNow.toGMTString();
        $("div").append("GMT time: " + temp + "<br/>");
        var visitorTimeZone = "GMT " + -(rightNow.getTimezoneOffset() / 60);
        $("div").append(visitorTimeZone + "<br/>");
    });    
</script>
<div class="div"></div>