|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
bimal Smarty Elite
Joined: 19 Apr 2007 Posts: 423
|
Posted: Thu Jul 02, 2009 6:22 pm Post subject: Suffix in a day (1st, 2nd...) |
|
|
date_format in Smarty is not enough to print out the suffix of the days.
For example, I wanted to print out
Code: | Friday, 03rd July, 2009 |
, but it is not possible with:
Code: | {$smarty.now|date_format:'%A, %e %B, %Y'} |
. Hence, I decided to go with php's callable date:
Code: | {'l, dS F, Y'|date} |
Is this a nice trick over Smarty's default distribution?
If you would like to help me, please let me know, how to remove 0 in the days where, the day is less than 10. For example, it gives 01st, but I want 1st. |
|
Back to top |
|
jLix Smarty Regular
Joined: 01 Apr 2009 Posts: 59 Location: Lowlands, EU
|
Posted: Fri Jul 03, 2009 2:33 am Post subject: Re: Suffix in a day (1st, 2nd...) |
|
|
bimal wrote: | If you would like to help me, please let me know, how to remove 0 in the days where, the day is less than 10. For example, it gives 01st, but I want 1st. |
Code: | {'l, jS F, Y'|date} | instead of Code: | {'l, dS F, Y'|date} |
_________________ http://jlix.net/extensions/smarty |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Thu Feb 04, 2010 11:03 pm Post subject: |
|
|
FYI, Smarty 3 date_format modifier now accepts php date() style formatters. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|