1
JamesSAEP
Smarty Time?
  • 2005/6/30 23:34

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


I have the following code for a date:

<{$smarty.now|date_format:"%A, %B %e, %Y"}>

I can't find any reference to the characters that are recognized in the format string for Time. It seems that the smarty code is different than standard PHP time.

Can someone link me to them?

Thanks.

2
Dave_L
Re: Smarty Time?
  • 2005/7/1 1:38

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7



3
JamesSAEP
Re: Smarty Time?
  • 2005/7/6 15:24

  • JamesSAEP

  • Just can't stay away

  • Posts: 732

  • Since: 2005/2/28


Thanks Dave_L.

4
ralf57
Re: Smarty Time?
  • 2005/7/6 16:13

  • ralf57

  • Quite a regular

  • Posts: 231

  • Since: 2003/2/3 1


If you have the desired locales installed into your/your host's system,you can even force smarty to display the date in your desired language.
Add this piece of code right before smarty's date function
<{php}>setlocale(LC_TIME"it_IT");<{/php}>

and edit it according to your needs.
An example:
<{php}>setlocale(LC_TIME"it_IT");<{/php}>
<{
$smarty.now|date_format:"%A, %e %B %Y"}>

will display:
mercoledì, 6 luglio 2005
the date is formatted into italian.
Really easy!
Don't know what i want but i know how to get it..........

5
urbanspacema
Re: Smarty Time?

hello
I have to show the date of a module and I used this example to make the Italian localization.

there is a way to make the location automatically?

6
frankblack
Re: Smarty Time?
  • 2009/6/16 16:33

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
there is a way to make the location automatically?


What do you mean? When switching the language on your site the setlocale has to be something else?

If yes, I would try to use some global defines (defined for each language). Don't know if this works.

Login

Who's Online

344 user(s) are online (261 user(s) are browsing Support Forums)


Members: 0


Guests: 344


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits