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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2004
    Location
    Florida, USA
    Posts
    275
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting a specific timezone's time to mysql instead of server's time

    Quick question

    <input type=hidden name="date" value="<?php echo date("F dS, Y h:i:s A");?>">

    allows me to place the server's time on mysql database, is there a way that I can change the time to a specific timezone instead off adding or substracting hours to make up for the diffrence?

  • #2
    Regular Coder
    Join Date
    Feb 2004
    Location
    Florida, USA
    Posts
    275
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well, I Found how to do it, and with diffrent time zones, so if anyone is interested in doing so, this is how

    <?
    echo "Original Time: ". date("h:i:s")."\n";
    putenv("TZ=EST5EDT");
    echo "New Time: ". date("h:i:s")."\n";
    ?>

    that sets it to eastern time

    other times I found where

    //putenv("TZ=EST5EDT"); // Eastern Time
    //putenv("TZ=AST9ADT"); // Alaskan Time
    //putenv("TZ=PST8PDT"); // Pacific Time
    //putenv("TZ=MST7MDT"); // Mountain Time
    //putenv("TZ=CST6CDT"); // Central Time
    //putenv("TZ=GMT0"); // Greenwich Mean Time
    //putenv("TZ=UTC0"); // Universal Time Coordinated

    personally since I want to keep track of these zones, I created a file that is called upon by the scrip and simply has

    Code:
    <?
    putenv("TZ=EST5EDT");
    //putenv("TZ=EST5EDT"); // Eastern Time 
    //putenv("TZ=AST9ADT"); // Alaskan Time
    //putenv("TZ=PST8PDT"); // Pacific Time
    //putenv("TZ=MST7MDT"); // Mountain Time
    //putenv("TZ=CST6CDT"); // Central Time
    //putenv("TZ=GMT0"); // Greenwich Mean Time
    //putenv("TZ=UTC0"); // Universal Time Coordinated 
    ?>
    like that it dosent inform the user that it is being changed, exactly what i wanted


  •  

    Posting Permissions

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