Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP timezone question

    Hi,

    Beginner question ... I have the following code:

    PHP Code:
    $todayis date("l, F j, Y, g:i a") ; 
    It produces the following:
    Sunday, March 21, 2010, 3:28 pm

    Which is great, but it is in CST (America) and I need it in AST (Canada)

    So I need it to show 2 hours ahead of what it is showing now.

    Any simple fix ?

    thanks

  • #2
    Senior Coder
    Join Date
    Jul 2009
    Location
    South Yorkshire, England
    Posts
    2,318
    Thanks
    6
    Thanked 304 Times in 303 Posts
    Code:
    $todayis = date("l, F j, Y, g:i a", (time()+7200));

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks VERY much ... I fiddled with this for a while but couldnt get it right.

    Works perfectly.

    Cheers,
    k

  • #4
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    Or:

    http://php.net/manual/en/timezones.php

    http://www.php.net/manual/en/timezones.america.php


    PHP Code:
    <?php
    date_default_timezone_set
    ('America/St_Johns');
    echo 
    date('D,F j, Y, h:i:s A');
    ?>
    EDIT: After a quick look through the first link Canada/Eastern might be better than America/St_Johns. It's listed under "Others".





    --------
    Last edited by Len Whistler; 03-22-2010 at 12:37 AM.
    Leonard Whistler


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •