skip to Main Content

How to filter mongodb collection using date field?

I have date string like this '2021-03-09' And my mongodb collection like this { "_id": { "$oid": "633aede250625c10dddfd57b" }, "title": "test 1", "description": "Hello World", "date": { "$date": "2021-03-09T18:30:00.000Z" }, "image": "fd16b297-9ad1-4e84-8c3e-715a33b351b3.png", "createdAt": { "$date": "2022-10-03T14:12:50.399Z" }, "updatedAt": { "$date":…

VIEW QUESTION

Which date format is this? – PHP

I want to convert this date-time string 2022-09-30T21:39:25.220185674Z to yyyy-mm-dd hh:mm:ss but it returns 1970-01-01 01:00:00 everytime. Tried with: date('Y-m-d H:i:s', strtotime('2022-09-30T21:39:25.220185674Z')); or date('Y-m-dTH:i:s', strtotime('2022-09-30T21:39:25.220185674Z')); Can you help find out which format this is and how i could corretly format…

VIEW QUESTION

In Laravel controller file, I would like to change the date format of regDate from 'Y-m-d' to 'd/m/Y'. RegDate from table is in YYYY-mm-dd

I would like to format "regDate" to 'dd/mm/YYYY' from 'YYYY/mm/dd'. Appreciate any help. Thanks. if ($request->keyword != "") { $students = Student::where ("name","LIKE","%" . $request->keyword . "%") ->orWhere("nric","LIKE","%" . $request->keyword . "%") ->orWhere("address","LIKE","%" . $request->keyword . "%") ->orWhere("telNo","LIKE","%" . $request->keyword…

VIEW QUESTION
Back To Top
Search