I have a date format like '2016-09-21'
. What I want to achieve is given that day find the first second of the first day of the current month (current year).
I want to do this because a have a MySQL column with a DATETIME
format. So I want to SELECT
all records of the current month.
You can use SQL to get all records of the current month:
select * from your_table
where year(curdate()) = year(datecolumn)
and month(curdate()) = month(datecolumn)