While you're storing datetime in epoch timestamp format, I think solutions using MySQL date/time functions could be very slow. So, I suggest using timestamp itself like below codes.
Usage example
$t = time();
# today
echo date('Y-m-d H:i:s', strtotime('today', $t))."
";
echo date('Y-m-d H:i:s', strtotime('tomorrow', $t))."
";
# this week
echo date('Y-m-d H:i:s', strtotime('-1 sunday', $t))."
";
echo date('Y-m-d H:i:s', strtotime('sunday', $t))."
";
# this month
echo date('Y-m-d H:i:s', strtotime(date('Y-m-01 00:00:00', $t)))."
";
echo date('Y-m-d H:i:s', strtotime(date('Y-m-01 00:00:00', strtotime('next month', $t))))."
";
# this year
echo date('Y-m-d H:i:s', strtotime(date('Y-01-01 00:00:00', $t)))."
";
echo date('Y-m-d H:i:s', strtotime(date('Y-01-01 00:00:00', strtotime('next year', $t))))."
";
In query
# this year
$start_of_year = strtotime(date('Y-01-01 00:00:00', $t));
$end_of_year = strtotime(date('Y-01-01 00:00:00', strtotime('next year', $t)));
$query = "SELECT * FROM sometable WHERE somecolumn >= $start_of_year AND somecolumn < $end_of_year";