如何在特定时区的php中查找星期几 [英] How to find day of week in php in a specific timezone
本文介绍了如何在特定时区的php中查找星期几的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在使用php处理日期/时间时感到困惑。
I am confused while using php to handle date/time.
我想要做的是这样的:当用户访问我的页面时,我问他的时区然后在他的时区显示星期几。
What I am trying to do is this: When a user visits my page I am asking his timezone and then displaying the 'day of week' in his timezone.
我不想使用浏览器的一天。
我想在php中做这个计算。
I don't want to use the browser's day. I want to do this calculation in php.
这是我试图实现的:
- 用户输入的时区
- 由php time()函数计算的Unix时间戳。
但我不知道如何继续...
我将如何在这个时区获得星期几。
But I dont know how to proceed... How would i get the 'day of week' in this timezone.
推荐答案
$dw = date( "w", $timestamp);
你可以在这里看到$ dw将为0(星期日)到6(星期六) :
http://www.php.net/manual/en/ function.date.php
Where $dw will be 0 (for Sunday) through 6 (for Saturday) as you can see here: http://www.php.net/manual/en/function.date.php
这篇关于如何在特定时区的php中查找星期几的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文