php - Format string of date in Smarty -


so have these templates (.tpl files) being generated smarty. have variable {$projects.laycanenddate} contains date in string format 12/24/2016 need displayed in format 24-dec-16.

i tried parsing text code

    {php}         $date = date_create($projects.laycanenddate);         $projects.laycanenddate = date_format($date, 'y-m-d h:i:s');     {/php}  <div class="right_olbl"> {$projects.laycanenddate} </div> 

but isn't working, since it's ignoring {php}...{/php} if wasn't there. read there <?php ... ?> tags, i'm lost ones should use. appreciated!

just assign date

 $smarty->assign('date', strtotime('-1 day')); 

format in tpl using smarty:

{$date|date_format:'%e-%b-%y'} 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -