+ Reply to Thread
Results 1 to 7 of 7

Thread: setting website time to gmt?

  1. #1
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    setting website time to gmt?

    i tried this but its a php5 function...any ways around? cause else the times on my site dont match

  2. #2
    Bryon is online now Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: setting website time to gmt?

    Maybe something like:

    PHP Code:
    ini_set('date.timezone''[Timezone Here]'); 
    I'm not sure if that will work, or what the string is for timezones. The appendix page says:

    Quote Originally Posted by http://us3.php.net/manual/en/ref.datetime.php#ini.date.timezone
    date.timezone string

    The default timezone used by all date/time functions if the TZ environment variable isn't set. The precedence order is described in the date_default_timezone_get() page.

  3. #3
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: setting website time to gmt?

    rock on thanx a lot ;)

  4. #4
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: setting website time to gmt?

    ok this doesn't seem to be working :s i can use this in php right?
    right befor i do this?
    $date = date("Y-m-d G:i");

  5. #5
    Bryon is online now Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: setting website time to gmt?

    PHP Code:
    $date date("Y-m-d G:i"); 
    That will return the date/time in the format between the "'s. I'm not sure, like I said in my orginal post if the ini_set() will set the date.timezone to the correct timezone, as I have not tested it myself. If you call that date() function like you posted AFTER you used the ini_set() function, (And ini_set() did successfully change the timezone), then your date() function should return the date/time in the timezone you set. If ini_set() did not work, your date/time will be returned in the CST (GMT -6) timezone.

    You can check the return value from ini_set() to see what it returns. I believe if the function successfully changed the configuration value it will return the old value, and if it didn't, false. So if it "works", you can get the format of teh old timezone in the configuration file and see what the GMT timezone format should be.

  6. #6
    hyeclass is offline x10 Sophmore hyeclass is an unknown quantity at this point
    Join Date
    Dec 2005
    Posts
    174

    Re: setting website time to gmt?

    ok i got it working put inv(TZ=Europe/belgium) or something like that ...dont have the code open atm
    but the one u gave works for php version 5 and higher but we have 4.xxx

  7. #7
    Bryon is online now Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: setting website time to gmt?

    "date.timezone "" PHP_INI_ALL Available since PHP 5.1.0."

    My bad, I didn't see that.. :-/

+ Reply to Thread

Similar Threads

  1. Which is the best free DNS ???
    By careerbridge in forum Scripts & 3rd Party Apps
    Replies: 37
    Last Post: 09-18-2009, 12:26 PM
  2. Replies: 18
    Last Post: 09-25-2006, 04:32 PM
  3. Replies: 3
    Last Post: 02-23-2006, 01:28 AM
  4. More time to create website
    By -Daniel in forum Feedback and Suggestions
    Replies: 6
    Last Post: 07-03-2005, 04:34 PM
  5. Cannot acces website and forums most of time
    By dbforum in forum Free Hosting
    Replies: 20
    Last Post: 03-06-2005, 03:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers