1. Show two digits after the decimal point
<{$num |string_format: '%.2f '}>
2. Display integer
<{$num |string_format: '%d '}>
3. Display as currency format
<{$num |number_format}>
4. Time format
{$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"}
OUTPUT:
Feb 6, 2001
Tuesday, February 6, 2001
14:33:00
Feb 5, 2001
Monday, February 5, 2001
14:33:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%a-abbreviated weekday name According to the current locale (output "Week" abbreviation format according to local format)%a-full weekday name according to the CUR Rent locale (output "Week" full format according to local format)%b-abbreviated month name according to the current locale (output "month" abbreviation format according to local format)%b-full month Name according to the current locale (output "month" in local format)%c-preferred date and time representation for the current locale %c-century Number (the year divided by and truncated to an integer, Range xx to)%d-day of the month as a DECIM Al number (range xx)%d-same as%m/%d/%y%e-day of the month as a decimal number, a single digit was preceded by Aspace (range 1 to +)%g-week-based year within century [00,99]%g-week-based year, including the century [0000,9999]% H-same as%b%h-hour as a decimal number using a 24-hour clock (range xx to)%i-hour as a decimal number using a 12-hour Clock (range)%j-day of the year as a decimal number (range 001 to 366)%k-hour (24-hour clock) Singl e digits is preceded by A blank. (range 0 to +)%l-hour as a decimal number using a 12-hour clock, single digits preceeded bya space (range 1 to)%m- Month as a decimal number (range)%m-minute as a decimal number%n-newline character%p-either ' am ' or ' PM ' According to the given time value, or the corresponding strings for the current locale%r-time in a.m. and p.m. Notatio n%r-time in hour notation%s-second as a decimal number%t-tab character%t-current time, equal to%h:%m:%s%u -Weekday as a decimal number [1,7], with 1 representing Monday%u-week number of the current year as a decimal number, Starting with the first Sunday as the first day of the first week%v-the ISO 8601:1988 Week number of the current year As a decimal number, range, where week 1is the first week that have at least 4 days Monday as the first day of the week. %w-day of the week as a decimal, Sunday being 0%w-week number of the current year as a decimal Number, starting with the first Monday as the first day of the first week%x-preferred date representation for the Curr ENT locale without the time%x-preferred time representation for the current locale without the date%y-year as a deci Mal number without a century (range xx to)%y-year as a decimal number including the century%z-time zone or name O R abbreviation percent-a literal '% ' character
Smarty formatted output