# Php time correction

**URL:** <https://forum.kirupa.com/t/php-time-correction/21699>\
**Category:** Uncategorized\
**Created:** [May 25, 2003, 5:27am UTC](https://forum.kirupa.com/t/php-time-correction/21699 "2003-05-25T05:27:36Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![andr\_in](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/andr_in/32/37_2.png) [@andr\_in](https://forum.kirupa.com/u/andr_in)\
**Post date:** [May 25, 2003, 5:27am UTC](https://forum.kirupa.com/t/php-time-correction/21699/1 "2003-05-25T05:27:36Z")

</div>

```php
date ("d.m.Y ( h:i A )")

```

The date is fine bit This shows me 1:25 AM when it’s 6:25 AM GMT  
How do I get it to show the GTM time?  
Oh and how to put “GMT” after it?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 5:29am UTC](https://forum.kirupa.com/t/php-time-correction/21699/2 "2003-05-25T05:29:03Z")

</div>

Does this help at all?

[http://www.php.net/manual/en/function.date.php](http://www.php.net/manual/en/function.date.php)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 12:05pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/3 "2003-05-25T12:05:53Z")

</div>

umm… that’s where I got the dam function! so me thinks me not findink solution from deer!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 1:12pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/4 "2003-05-25T13:12:31Z")

</div>

I’m pretty sure that the date() function displays the server time, so I guess you could figure out what the server time is and add or subtract the hours to your hours thing. That would be a messy solution though because if it was like 12 o’clock for instance, it might show up as 16. or 24 could be 28. You should probably use javascript because it gets the users time, not the servers.

If I’m wrong in all this just tell me, but I’m pretty sure thats how it works

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 1:39pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/5 "2003-05-25T13:39:48Z")

</div>

well I dunno! But I think the user time would be no good since I’m using that in a guestbook. All the timezones are different so… that wouldn’t work well…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 2:00pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/6 "2003-05-25T14:00:52Z")

</div>

the date() function in PHP displays the server time since it is a server side script. Do you want it to show the time from your timezone? you would have to get the hour separately and then add to it, and then combine the strings…

```php

<?
$tz = 3;
$hour = date("g");
$time = date(":i");
$hour = $hour + $tz;

$realTime = $hour.$time;

print $realTime;
?>

```

Where $tz is your timezone offset. Determine the time of your server and then subtract your current time and you’ll get your offset.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 2:15pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/7 "2003-05-25T14:15:13Z")

</div>

hm… it should be gmt cuz it’s a guestbook… Different ppl sig to a guestbook & different ppl live in different timezones so all the times would be messed up.  
I can replace “$tz” with a number to get Gmt yes? Would that work?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 25, 2003, 3:53pm UTC](https://forum.kirupa.com/t/php-time-correction/21699/8 "2003-05-25T15:53:20Z")

</div>

Thanks for chiming in Jubba. Im not hip on my PHP, but now that I am on a server that supports more PHP than my last server I will be hopefully be learning it more 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 12:38am UTC](https://forum.kirupa.com/t/php-time-correction/21699/9 "2003-05-26T00:38:01Z")

</div>

Syko: yeah. Determine what time your server is on, and then figure out what time GMT is and subtract to figure it out. That should work. You’ll have to edit things around of course because thats probably not the format that you wnat or anything, but I’m sure you can figure that all out. If you need anything else just ask away. 🙂

Lib: If you ever need any PHP help just let me know. You know my AIM screen name… just give me a shout. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 1:22am UTC](https://forum.kirupa.com/t/php-time-correction/21699/10 "2003-05-26T01:22:22Z")

</div>

I will do Jubba, thank you for the offer 🙂 I am so glad to finally be on a server where I can do actual PHP (my last server only allowed limited PHP like mailforms and stuff)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 1:27am UTC](https://forum.kirupa.com/t/php-time-correction/21699/11 "2003-05-26T01:27:59Z")

</div>

I love PHP. I wish I could show you the admin panel I just created for my friends band site. I’m pretty proud of it because they loved it. They can control everything about the site from that page. 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 26, 2003, 1:35am UTC](https://forum.kirupa.com/t/php-time-correction/21699/12 "2003-05-26T01:35:40Z")

</div>

WOW… I need me one of those thingamabobbers! Ok I don’t, but I have a friend that would love one of those…lol.
