#compare string with date - eloquent ORM
10 messages · Page 1 of 1 (latest)
Yea. You answered me and it worked. The problem is that tgive to make a change to the code. in the variable mes_ano I'm not inserting it as a date, but as a string. How do I compare a string with a date?
So the field in the database is a text field and not a date field?
it looks like this ... where('2022-11' string, '2022-11' Date)
That is mes_ano in the DB?
On the ceiling table yes. Because I only need the month and year
month_year
That is going to make things tough for comparison, you should really be using a date field if you want to make datetime comparisons.
You might be able to cast it to a date using DB::raw, but it is going to be very slow.
How do I save only the month and year in DB?