Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » time function

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: 595 Views
  • Arbee
    Community Member
    17 Posts

    time function Link to this post


    Can someone please help me with a time issue? I have dates in the database and want to determine if the current date is in between them. I have written a function using strtotime() which I thought was working but doesn't appear to be now. My two date fields look like this: 'RegStart' => 'Date', 'RegStop' => 'Date',

    I wrote a function like this:
    function openForReg() {
          $regClass = DataObject::get('Product', "`Location` = 'AOQ'", "rand()", "", "1");
          if (strtotime($this->RegStart) < time() AND strtotime($this->RegStop) > time()) return $regClass;

    Where am I going wrong?
    Thanks for any help.

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.