代码如下:
$smarty = new Smarty;
$smarty->assign('yesterday', strtotime('-1 day'));
$smarty->display('index.tpl');
index.tpl:
{$smarty.now|date_format}
{$smarty.now|date_format:"%A, %B %e, %Y"}
{$smarty.now|date_format:"%H:%M:%S"}
{$yesterday|date_format}
{$yesterday|date_format:"%A, %B %e, %Y"}
{$yesterday|date_format:"%H:%M:%S"}

输出代码如下:
Feb 6, 2001
Tuesday, February 6, 2001
:33:00
Feb 5, 2001
Monday, February 5, 2001
:33:00

常用格式:{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}   显示2010-05-16 05:20:14

更多请参看smarty手册,下面只作简单几个介绍。。

%a - abbreviated weekday name according to the current locale
(根据当地格式输出“星期”缩写格式)
%A - full weekday name according to the current locale
(根据当地格式输出“星期”全称格式)
%b - abbreviated month name according to the current locale
(根据当地格式输出“月”缩写格式)
%B - full month name according to the current locale
(根据当地格式输出“月”全称格式)

最新文章

  1. 将 VMware 最小化到系统托盘
  2. Ruby on rails学习笔记——安装环境
  3. [ASP.NET] 下一代ASP.NET开发规范:OWIN
  4. Spring的replace-method标签
  5. javabean与map互转
  6. POJ 2127
  7. WiFi安全之WPA介绍
  8. DJANGO的ORM的Q查询作多字段外键的模糊查询样码
  9. h2database源码浅析:TransactionMap、MVMap、MVStore
  10. C#日期格式精确到毫秒以及上下午
  11. 360极速浏览器在XP系统下的一个bug
  12. ID选择器
  13. JSON 基本语法
  14. 实战DeviceIoControl 之四:获取硬盘的详细信息
  15. 安装Oracle Grid的过程中用到的几个小技巧
  16. 小程序快捷键(mac中)
  17. Linux 禁止root 用户登录启用sudo
  18. codeforces 678C. Joty and Chocolate(容斥) 2016-10-15 21:49 122人阅读 评论(0) 收藏
  19. 结合 RunLoop 和 Instrument 定位卡顿
  20. webservice的 发布

热门文章

  1. 修改msconfig->引导->高级选项-》最大内存为512M
  2. HTML+CSS学习笔记(4) - 认识标签(3)
  3. spring aop配置及用例说明(1)
  4. CAF(C++ actor framework)使用随笔(延迟发送,消息转发,消息优先级)(四)
  5. Qt自绘窗体
  6. fedora下python3 安装tkinter和pygame
  7. 一种C# TCP异步编程中遇到的问题
  8. OWIN OAuth 2.0 Authorization Server
  9. 多线程的单元测试工具 - GroboUtils
  10. xaml中绑定单例属性