【问题标题】:the first day of the month一个月的第一天
【发布时间】:2014-11-21 10:51:25
【问题描述】:

我正在尝试在 php 中构建我的议程,使用 strtotime 根据用户的需求返回日期,但我发现 strtotime 存在一个可理解的问题!

当我说 2014 年 9 月的第一个星期一时,它给了我 9 月 8 日。 通常它应该在 9 月 1 日返回!

你怎么看?

<?php
$j = strtotime("First Monday Septembre 2014");
echo date('d F',$j);
?>

同样的问题

<?php
$j = strtotime("First Monday July 2013");
echo date('d F',$j);
?>

否则当日期不是当月的第一天时,它会给你正确的一天

【问题讨论】:

标签: php strtotime


【解决方案1】:

$j = strtotime("2014 年 9 月的第一个星期一"); echo date('d F',$j);

以上代码将返回结果为“01 September”。

尝试一下,如果您遇到任何错误,请告诉我。

祝你好运

【讨论】:

  • 是的,“of”是我的问题之源,非常感谢
猜你喜欢
  • 1970-01-01
  • 2013-08-30
  • 1970-01-01
  • 1970-01-01
  • 2015-08-17
  • 1970-01-01
  • 2020-10-02
  • 2015-02-06
  • 2013-02-14
相关资源
最近更新 更多