2017-05-22 50 views
2
while($chat = $result->fetch_object()){ 

     // Returning the GMT (UTC) time of the chat creation: 

     $chat->time = array(
      'hours'  => date('H',strtotime($chat->ts)), 
      'minutes' => date('i',strtotime($chat->ts)) 
     ); 

我正在使用此代碼顯示聊天消息的時間。如何更改此代碼以在IST時區中顯示輸出時間?謝謝以PHP格式將IST(亞洲/加爾各答)時間更改爲UTC時間

回答

3

您已經幾種方法來實現這一目標,一個簡單的使用date_default_timezone_setdate之前,即:

date_default_timezone_set('Asia/Kolkata'); 
相關問題