简体   繁体   English

Drupal 7如何在page.tpl.php中打印当前日期

[英]Drupal 7 how can I print a current date in page.tpl.php

请帮助,我想在网页顶部打印当前日期,我正在使用drupal7。请让我知道如何在page.tpl.php文件中打印当前日期。

Just add this line wherever you want to in page.tpl.php : 只需在page.tpl.php任何位置添加此行:

echo date('d/m/Y');

That will put the date out in dd/mm/yyyy format, see PHP's Date function for a list of all the possible formats. 这将以dd/mm/yyyy格式显示日期 ,有关所有可能格式的列表,请参见PHP的Date函数

hai also use time() function for getting the time stamp hai还使用time()函数获取时间戳

and format the date with drupal function format_date(); 并使用drupal函数format_date()格式化日期; format date 格式日期

还有常量REQUEST_TIME- https: //api.drupal.org/api/drupal/includes! bootstrap.inc/constant/REQUEST_TIME/7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM