我想过滤当前月份数据但遇到问题:
$months = array(01 => "JAN", 02 => "FEB", 03 => "MAR", 04 => "APR", 05 => "MAY", 06 => "JUN", 07 => "JUL", 08 => "AUG", 09 => "SEP", 10 => "OCT", 11 => "NOV", 12 => "DEC");
$date = getdate();
$month = $date['mon'];
$Month_Name = $months[$month];
echo $Month_Name;
$query = oci_parse($con, "SELECT FIR.*, ACCUSED.* FROM FIR INNER JOIN ACCUSED ON FIR.FIR_NO = ACCUSED.FIR_NO WHERE FIR_DATE = '$Month_Name' ORDER BY FIR_DATE DESC");
现在的问题是,如果我FIR_DATE = '04-$Month_Name-14'
这样做有效,我的日期格式就像08-MAR-14
,但这不允许我获得月份数据。任何帮助将不胜感激。
答案 0 :(得分:1)
我不确定我是否理解,但我认为这就是你想要的。
$query = oci_parse($con, "SELECT FIR.*, ACCUSED.* FROM FIR INNER JOIN ACCUSED
ON FIR.FIR_NO = ACCUSED.FIR_NO WHERE
TO_CHAR(TO_DATE(FIR_DATE, 'DD-MON-YYYY'), 'MON')= '$Month_Name'
ORDER BY FIR_DATE DESC");
答案 1 :(得分:0)