第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在 yii2 中使用 start_time 和 end_time 獲取 MySql 中已經(jīng)存在的

如何在 yii2 中使用 start_time 和 end_time 獲取 MySql 中已經(jīng)存在的

PHP
元芳怎么了 2022-10-28 15:46:13
我有tbl_batch哪個(gè)idtitlestart_datestart_timeend_timevenue_idcreated_by在數(shù)據(jù)庫中 start_time 和 end_time 被保存為time()排:-id 1title teststart_time 10:10end_time 11:30venue_id 1start_date 2020-03-01 (Y-m-d)created_by 1所以我想檢查時(shí)間是否在給定start_time的.end_timestart_date我試過的查詢:-$model = Batch::find()->where(['start_date' => '2020-03-01','venue_id' => 1])->andWhere(['AND',[ '>=',  'start_time',  '10:20'],[ '<=',  'end_time',  '19:20']]);if($model->exists()){      echo 'Already exists in DB';}else{      echo 'Does not Exist';}這沒有返回正確的輸出。
查看完整描述

1 回答

?
達(dá)令說

TA貢獻(xiàn)1821條經(jīng)驗(yàn) 獲得超6個(gè)贊

我終于想通了:)



   $time_between = Batch::find()->where([

                   'start_date' => '2020-03-01',

                   'venue_id' => 1

                ])->andWhere([


                    'OR',

                    [

                        'OR',


                        [

                            'between',

                            'end_time',

                            $model->start_time,

                            $model->end_time

                        ],

                        [

                            'between',

                            'start_time',

                            $model->start_time,

                            $model->end_time

                        ]

                    ],

                    [


                        'AND',

                        [

                            '<=',

                            'start_time',

                            $model->start_time

                        ],

                        [

                            '>=',

                            'end_time',

                            $model->start_time

                        ]

                    ]

                ]);


查看完整回答
反對(duì) 回復(fù) 2022-10-28
  • 1 回答
  • 0 關(guān)注
  • 123 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)