Guest User

Untitled

a guest
Apr 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. Entry::find()->startDate('>='. $someTime).endTime('<='.$someOtherTime).all();
  2.  
  3. Entry::find()
  4. ->variantOne('<=' . Db::prepareDateForDb(new DateTime())) <-- DateTime object
  5. ->variantTwo('<=' . time()) <-- as timestamp
  6. ->variantThree('<=' . (new DateTime())->format('U')) <-- timestamp as well
  7. ->variant(['and', '<=' . time() , '>=' . time() - 3600]) <-- entries within the last hour
Add Comment
Please, Sign In to add comment