 |
|
คิดว่าได้แล้วครับ ไม่รู้ว่าผิดพลาดตรงไหนหรือเปล่า
รบกวนเพื่อน ๆ เอาไปทดสอบให้ทีนะครับ ขอบคุณครับ
fnc_calc.php
function between_date($start,$end,$post)
{
//split start time
$y_start=date("Y",strtotime($start));
$m_start=date("m",strtotime($start));
$d_start=date("d",strtotime($start));
$h_start=date("H",strtotime($start));
$i_start=date("i",strtotime($start));
$s_start=date("s",strtotime($start));
//split end time
$y_end=date("Y",strtotime($end));
$m_end=date("m",strtotime($end));
$d_end=date("d",strtotime($end));
$h_end=date("H",strtotime($end));
$i_end=date("i",strtotime($end));
$s_end=date("s",strtotime($end));
//split position time
$y_post=date("Y",strtotime($post));
$m_post=date("m",strtotime($post));
$d_post=date("d",strtotime($post));
$h_post=date("H",strtotime($post));
$i_post=date("i",strtotime($post));
$s_post=date("s",strtotime($post));
//convert all with mktime()
$mk_start=mktime($h_start,$i_start,$s_start,$m_start,$d_start,$y_start);
$mk_end=mktime($h_end,$i_end,$s_end,$m_end,$d_end,$y_end);
$mk_post=mktime($h_post,$i_post,$s_post,$m_post,$d_post,$y_post);
if(($mk_post>=$mk_start)&&($mk_post<=$mk_end))
{
return true;
}
else
{
return false;
}
}
test.php
include("fnc_calc.php");
$leave_start="2010-11-05 09:00:35";
$leave_end="2010-11-05 20:50:11";
$leave_post="2010-11-05 09:58:48";
if(between_date($leave_start,$leave_end,$leave_post))
{
echo "TRUE";
}
else
{
echo "FALSE";
}
|
ประวัติการแก้ไข 2011-05-04 10:46:45 2011-05-04 10:47:23 2011-05-04 10:55:49
 |
 |
 |
 |
Date :
2011-05-04 10:45:35 |
By :
NarinNil |
|
 |
 |
 |
 |
|
|
 |