Jump to:

23364 Posts in 18125 Topics by 2862 members

General Questions

SilverStripe Forums » General Questions » Need help to print two Countries time in the templete

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

Page: 1
Go to End
Author Topic: 243 Views
  • Mr.Neel
    Avatar
    Community Member
    2 Posts

    Need help to print two Countries time in the templete Link to this post

    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.

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Need help to print two Countries time in the templete Link to this post

    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}

  • Mr.Neel
    Avatar
    Community Member
    2 Posts

    Re: Need help to print two Countries time in the templete Link to this post

    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.

    243 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.