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.


echo date('Y-m-d- G:i:s'); # systme
echo date('Y-m-d- G:i:s'); # GMT
commented: :) +14
Member Avatar

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


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


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

commented: ;D +7

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

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.


Member Avatar

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

Below is the code.



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.

Member Avatar
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.