$a = strtotime('-5 month'); $b = strtotime('-3 month'); $sql ="SELECT * FROM tabla WHERE fecha BETWEEN $a AND $b";