0

What am trying is to query orders created between two dates

so i have

$maxdate = ; //timestamp value
$mindate = ; //timestamp value   


$orders = Orders::find()->where(["created_at" ..]) //stuck hre

IN normal words would be

find where created_at is between $maxdate and $mindate

How do i go about this?

Geoff
  • 6,277
  • 23
  • 87
  • 197
  • Possible duplicate of [Yii2 model search between query](https://stackoverflow.com/questions/43318711/yii2-model-search-between-query) – ryantxr Aug 22 '17 at 20:21

1 Answers1

3

You may achieve your goal by this

$orders = Orders::find()->where(["between", "created_at", $mindate, $maxdate])

This is the fully reference about building various of Queries

Paul
  • 1,630
  • 1
  • 16
  • 23