Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Need help to print two Countries time in the templete


Reply

3 Posts   271 Views

Avatar
Mr.Neel

26 May 2013 at 5:10pm Community Member, 2 Posts

I am trying to display two countries time on my website. I have achieved the NZ time ( NZ time: 12:13pm Sunday, 26 May 2013 (NZST) ) but require help to set time for Australia ( AUS time: ). Any suggestions will be appreciated.

Avatar
Bambii7

28 May 2013 at 1:01pm Community Member, 254 Posts

AUS is a little trickier than NZ as it has multiple time zones (dam WA which can be 3 - 4 hours behind NZ).

A simple example would be on the model object put a new public function

public function aus_time() {
return date('Y / m / d G:i:s', strtotime('+2 hours'));
}


in the template call

{$myobject.aus_time}

Avatar
Mr.Neel

29 May 2013 at 1:40am Community Member, 2 Posts

Thank you very much for your help. i will have to change the code a little bit to get the format i wanted but nice it is working.