1
blackrx
multilanguage: Show Date and time
  • 2010/6/27 0:05

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


i have multilanguage in mysite by using xlanguage

in language/english..calendar.php & global.php there are definition about months/date/year i have translate it to my language

i want to show date and time in my site like this

Sunday, 27 June 2010 | 8.05am


how do i do this


2
Catzwolf
Re: multilanguage: Show Date and time
  • 2010/6/27 9:53

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


l, d M Y | h:i a

3
blackrx
Re: multilanguage: Show Date and time
  • 2010/6/27 10:43

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


thank you catzwolf

i use this in my theme

<{php}> echo date('l, d M Y | h:i a');

<{/php}>

and it worked but it is not translated to my language if i change my language

any other place to look beside locale.php, global.php and calendar.php for date and time language definition ?

EDIT: Solved using setlocale() instead of date():

http://php.net/manual/en/function.date.php

php newbie here

4
culex
Re: multilanguage: Show Date and time
  • 2010/6/27 11:59

  • culex

  • Module Developer

  • Posts: 711

  • Since: 2004/9/23


Try putting the smarty php <{php}> echo date('l, d M Y | h:i a');<{/php}> inside your language codetags... like this

[en]<{php}> 
$weekday date('w');
$date date(d M Y);
$time =  date('h:i a');
$day = array('søn','man','tirs','ons','tors','fre','lør');
echo 
"Today it's " $day[$weekday] ." ".$date" and the time is ".$time;
<{/
php}>[/en]


I havent tested but should work. And then you just make another for [en] [es] [de] or how many you use
Programming is like sex:
One mistake and you have to support it for the rest of your life.

5
blackrx
Re: multilanguage: Show Date and time
  • 2010/6/27 12:09

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


thanks culex...i've solved it using the php setlocale

6
mboyden
Re: multilanguage: Show Date and time
  • 2010/6/29 15:47

  • mboyden

  • Moderator

  • Posts: 484

  • Since: 2005/3/9 1


You can also use <{$smarty.now}> to get the current date/time stamp and you can use the smarty modifier "date_format" to change it on the fly, all without using PHP in your template.

More info on the smarty date_format modifier manual page.
Pessimists see difficulty in opportunity; Optimists see opportunity in difficulty. --W Churchill

XOOPS: Latest | Debug | Hosting and Web Development

Login

Who's Online

153 user(s) are online (103 user(s) are browsing Support Forums)


Members: 0


Guests: 153


more...

Donat-O-Meter

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

Latest GitHub Commits