Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Php Date()?, timezone is offset
flashy
post Mar 25 2008, 07:27 AM
Post #1


Member [Level 1]
****

Group: [HOSTED]
Posts: 60
Joined: 7-March 08
From: Swindon, England
Member No.: 59,016



Hi my timezone is GMT and the code im using to display the time and date is this:
CODE
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?

This post has been edited by flashy: Mar 25 2008, 07:27 AM
Go to the top of the page
 
+Quote Post
sonesay
post Mar 25 2008, 07:31 AM
Post #2


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 685
Joined: 20-June 07
From: Auckland
Member No.: 45,102



http://www.trap17.com/forums/php-time-difference-t56225.html A topic by me a while back. I think this is what your after just have a bit of a read.
Go to the top of the page
 
+Quote Post
flashy
post Mar 25 2008, 07:44 AM
Post #3


Member [Level 1]
****

Group: [HOSTED]
Posts: 60
Joined: 7-March 08
From: Swindon, England
Member No.: 59,016



I looked at the post, but every time i tried to use those techniques it just didnt work sad.gif.
Go to the top of the page
 
+Quote Post
sonesay
post Mar 25 2008, 07:53 AM
Post #4


|||[ n00b King ]|||
*********

Group: [HOSTED]
Posts: 685
Joined: 20-June 07
From: Auckland
Member No.: 45,102



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.
Go to the top of the page
 
+Quote Post
flashy
post Mar 25 2008, 05:15 PM
Post #5


Member [Level 1]
****

Group: [HOSTED]
Posts: 60
Joined: 7-March 08
From: Swindon, England
Member No.: 59,016



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 code
CODE
putenv("TZ=UK");
echo("h:i:s");


If you like in the United States and you live say Los Angeles you would do this...
CODE
putenv("TZ=US/Los_Angeles");
echo("h:i:s");


The full TimeZones are here

You can set the default timezone like this:
CODE
date_default_timezone_set('UTC');


And you can then format it
CODE
<?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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. My First Date With A Girl!(25)
  2. Muslims Not Allowed To Date(9)
  3. How To Implement A Date Picker On A Web Page(0)
  4. Online Date Scams(5)
  5. Date Time Lights Temp And Timer, It's Go It All(0)
  6. Personality Test - With Birth Date(18)
  7. Free Web Hosting : Amirborna [screened] [approved](3)
  8. Problem With Time/date On My Computer(6)
  9. Girls - What Kind Of A Date Do You Want?(17)
  10. Php - Forms, Date And Include(0)
  11. 5 Things Not To Do On Your First Date(4)
  12. Daiting?(2)
  13. Final Fantasy Advent Children(16)
  14. Reaon-sony Acid-orion Or Fruity Loops(1)
  15. Yesterday Is My First Date(3)
  1. What To Do On A Date(4)
  2. Saint Seiya(2)
  3. Displaying Date And Time (gmt+8)(5)
  4. Multilingual Possibilities In Php(2)
  5. First Date(3)
  6. Movie Release Date(8)
  7. My First Date(5)
  8. Project Offset(0)
  9. What Happen When You Will Come Late At Your First Date(6)
  10. Php Date() Problem [resolved](4)
  11. Show The Current Date/time With Php(1)
  12. Display The Current Date/time(3)
  13. Worst First Date....ever!(10)
  14. Change Timezone In Smf(2)
  15. World Of Warcraft: The Burning Crusade(0)


 



- Lo-Fi Version Time is now: 10th October 2008 - 08:01 PM