[英]How to get current date and time with respect to Time Zone in Codeigniter
當我在 codeigniter 中運行以下代碼時,它返回印度位置的錯誤時間和日期。 請讓我解決。
'date_default_timezone_set('Asia/Kolkata');
$date = date('Y-m-d H:i:s', time());
echo $date;'
嘗試這個
$now = new DateTime();
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
echo $now->format('Y-m-d H:i:s');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.