How to get local time in php?

前端 未结 7 1267
野性不改
野性不改 2021-02-02 03:12

I am trying to get the local time using php. I wrote two different versions, but they both give the wrong time

date_default_timezone_set(\'UTC\');
$now = new Dat         


        
相关标签:
7条回答
  • 2021-02-02 04:02

    Simply use function date_default_timezone_set(). Here is example:

    <?php 
    date_default_timezone_set("Asia/Dhaka");
    echo date('d-m-Y h:i:s A');
    ?>
    

    Hope it will help, Thanks.

    0 讨论(0)
提交回复
热议问题