Cách so sánh ngày năm tháng ngày trong smarty
Ví dụ: chúng ta cần so sánh 2 giá trị ngày như sau
– Ngày hiện
– Ngày cần so sánh (DateCompare)
Cách 1:
{assign var=DateCompare value='2014-01-22'}
{if $smarty.now|date_format:"%Y/%m/%d" > $DateCompare }
Ngày hiện tại lớn hơn ngày cần so sánh (DateCompare)
{/if}
or
Cách 2:
{assign var=toDay value=$smarty.now|date_format:"%Y/%m/%d"}
{if $DateCompare < $toDay}
Ngày hiện tại lớn hơn ngày cần so sánh (DateCompare)
{/if}
Chúc các bạn thành công
nhantam
Panpic Technology
Thiết kế web chạy trên điện thoại smartphone
Categories: Smarty
cach so sanh ngay thang nam smarty, smarty date compare
Comments (0)
Trackbacks (0)
Leave a comment
Trackback