4

Please I have search through stackoverflow and couldn't find the right answer to this. I want to output a date for my country Nigeria on a website.

Nigeria timezone is GMT+01:00

I have this

    <?php
         date_default_timezone_set("WAT");

         echo date("M d, Y h:i a")."<p></p>";
         //echo time();
    ?>
coder2014
  • 43
  • 1
  • 1
  • 6
  • possible duplicate of [addition of gmt times in php](http://stackoverflow.com/questions/2763459/addition-of-gmt-times-in-php) – Rohit Aggarwal Apr 21 '15 at 11:06

2 Answers2

7

I think you got the timezone wrong.
According to this list it is Africa/Lagos

<?php
date_default_timezone_set("Africa/Lagos");

echo "<p>" . date("M d, Y h:i a") . "</p>";
?>
Octfx
  • 691
  • 1
  • 7
  • 18
1

You need to set below timezone based on recommended TIMEZONE only

date_default_timezone_set("Africa/Lagos");

More details on Your country based timezone you can find on below link

http://php.net/manual/en/timezones.africa.php

In General For continent on the earth wise bifurcation you can refer below link

http://php.net/manual/en/timezones.php

Patel Nikhil
  • 185
  • 6