?
このドキュメントでは、 php中國語ネットマニュアル リリース
As a rule of thumb, always pass dates to Smarty as timestamps. This allows template designers to use date_format for full control over date formatting, and also makes it easy to compare dates if necessary.
就像一條經(jīng)驗法則,經(jīng)常是把日期當(dāng)成時間戳傳遞給Smarty。 這樣使得模板設(shè)計人員可以使用date_format[日期格式化]這個函數(shù)來對日期格式化進(jìn)行全面控制,當(dāng)然,這使得在需要比較日期的時候比較容易。
NOTE: As of Smarty 1.4.0, you can pass dates to Smarty as unix timestamps, mysql timestamps, or any date parsable by strtotime().
注意:從Smarty 1.4.0起,你可以像用unix中的時間戳,mysql中的時間戳,或者任何能夠用這個函數(shù)[strtotime()]進(jìn)行分析的時間戳那樣把日期傳遞給Smarty。
Example 18-4. using date_format 例 18-4. 使用日期格式化
|
When using {html_select_date} in a template, The programmer will most likely want to convert the output from the form back into timestamp format. Here is a function to help you with that.
當(dāng)在一個模板文件里使用{html_select_date}的時候,程序員將可能想在一個輸出文件中把這種形式轉(zhuǎn)回成時間戳的形式。下面就是一個可以幫助你達(dá)到目的的函數(shù)。
Example 18-5. converting form date elements back to a timestamp
|