如何在php中获得准确的IST时间? [英] How to get exact IST time in php?

查看:28
本文介绍了如何在php中获得准确的IST时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在php中,我使用了日期函数(例如:date('Y-m-d h-m-s'))它不会显示当前时间请帮帮我...

In php, I used date function (eg: date('Y-m-d h-m-s')) it won’t displaying current time Please help me…

推荐答案

更新:


您可以通过以下方式为您所在地区设置时区:

Update:


Here is how you can set time zone for your region:

if (function_exists('date_default_timezone_set'))
{
  date_default_timezone_set('Asia/Mumbai');
}


它应该可以正常工作.另请注意,您没有正确指定分钟.使用 i 分钟而不是 m:


It should work fine. Note also that you have not specified minutes correctly. Use i for minutes not m:

date('Y-m-d h-i-s')

并确保echo它:

echo date('Y-m-d h-i-s');

这篇关于如何在php中获得准确的IST时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆