Displaying server time on a webpage with a +6 hour offset

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kibit
    Junior Member
    • Nov 2005
    • 1

    Displaying server time on a webpage with a +6 hour offset

    Anyone know the simplest way to do this?

    I've done many hours of google searching and either get scripts that display only the users local computer time or the ones that do indeed display the server time I can't see a way to add the offset.

    If anyone could post the required code that would really be appreciated.

    Thanks in advance.

    Kibit.
  • JackT
    Junior Member
    • Nov 2006
    • 16

    #2
    What language does it have to be in? In PHP:

    Code:
    strtotime("+6 hours");
    would suffice.

    Comment

    • Elite
      Senior Member
      • Apr 2004
      • 168

      #3
      A while since I played with this, but I think I found the best way to handle timezones was using:

      PHP Code:
      date_default_timezone_set(); 
      and

      PHP Code:
      date_timezone_set() 

      Comment

      • james
        Senior Member
        • Mar 2004
        • 183

        #4
        Assuming you're using PHP, then Elite has pointed you in the right direction.

        I personally use the following:

        Code:
        date_default_timezone_set('Australia/Perth');
        echo date("D M j G:i:s T Y");
        You can customise the date's format as per php's date manual.

        Comment

        Working...