Hi my timezone is GMT and the code im using to display the time and date is this:date('l j F - g:i a')
which would then display "Tuesday 25 March - 12:11 am"
But the time for me at the time was 07:11 am. Anyone know how to tune it so it is with GMT time?
http://forums.xisto.com/topic/56225-php-time-difference-how-to-handle-different-time-zones/ A topic by me a while back. I think this is what your after just have a bit of a read.
I looked at the post, but every time i tried to use those techniques it just didnt work
Can you list some code and/or maybe the steps you are taking to handle the date? When you say it just doesn't work we have no idea what just doesn't work. The kettle doesn't work? My lines on the girls don't work? Please be a bit more specific about your problem if you wish to get better help. In your case I'm assuming your piece of code isn't doing what you want it to do so please post it so we can take a look.
OK i found out how to do it! I did a bit of google and this worked completely for me and it is simple.
I used this codeputenv("TZ=UK");echo("h:i:s");
If you like in the United States and you live say Los Angeles you would do this...putenv("TZ=US/Los_Angeles");echo("h:i:s");
The full TimeZones are here
You can set the default timezone like this:date_default_timezone_set('UTC');
And you can then format it<?php// Assuming today is: March 10th, 2001, 5:16:18 pm$today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm$today = date("m.d.y"); // 03.10.01$today = date("j, n, Y"); // 10, 3, 2001$today = date("Ymd"); // 20010310$today = date('h-i-s, j-m-y, it is w Day z '); // 05-16-17, 10-03-01, 1631 1618 6 Fripm01$today = date('\i\t \i\s \t\h\e jS \d\a\y.'); // It is the 10th day.$today = date("D M j G:i:s T Y"); // Sat Mar 10 15:16:08 MST 2001$today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month$today = date("H:i:s"); // 17:16:17?>Notice from jlhaslip:Merged
|VIEW DESKTOP VERSION||REGISTER||GET FREE HOSTING|