【发布时间】:2011-03-29 22:44:21
【问题描述】:
我使用的是 CCK 日期字段。 Mart 结束时的 strtotime (>=29 Mar) 将为 strtotime('1-month') 返回不正确的结果。
// Current date Mar 30
$time = strtotime('-1 month');
print date('m/d/Y', $time);
有什么想法吗?
【问题讨论】:
-
这不是 Drupal 问题,它与所有 PHP 相关。
-
虽然使用 date() 函数不是 Drupal 特有的,但重要的是要注意,对于 Drupal 中的大多数用途,应该使用 format_date() 函数 (api.drupal.org/api/drupal/includes--common.inc/function/…) 以便考虑了时区和其他 Drupal 特定的配置。