0

I need someone to put me through on how i can show GMT time on my php application. I have tried all possible time functions all to no avail. i don't want the time to have anything to do with my system time because i want the application to automatically delete a row in my database on 12 midnight GMT every day.

I appreciate all usual supports.

Thanks in advance.

4
Contributors
8
Replies
9
Views
5 Years
Discussion Span
Last Post by diafol
1

Try:

<?php
echo date('Y-m-d- G:i:s'); # systme
date_default_timezone_set("GMT");
echo date('Y-m-d- G:i:s'); # GMT
?>

Edited by cereal: n/a

Votes + Comments
:)
1

you need to set the timezone. A few ways, but I suppose the simplest is:

date_default_timezone_set('Europe/London');

OR if you specifically want GMT, just use GMT - I think that will avoid summer time changes specific for certain countries.

??EDIT

Bugger, beat me to it cereal - well that's payback for earlier I suppose! :)

Edited by diafol: n/a

Votes + Comments
;D
0

Hi ardav, thanks. I really want it for nigeria (gmt + 1). Can i specify nigeria in the function?

0

I need to print the exact GMT Time on my application. but the date_default_timezone_set() is still echoing the system time.

Please help me.

Thanks.

0

date_default_timezone_set() shouldn't echo anything - it sets. Anyway, show your code, we don't have the power of omniscience.

Edited by diafol: n/a

0

Below is the code.

<?php

date_default_timezone_set("GMT");

echo date('Y:M:d, G:i:s');



?>

I just want to use this to print it on a screen before i can embed it into the normal application. but it still echo system time.

0
echo date('Y-m-d H:i:s') . "<br />";
date_default_timezone_set ('GMT');
echo date('Y-m-d H:i:s');

Works for me.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.