【发布时间】:2015-11-02 16:06:39
【问题描述】:
my date is stored in database 11/01/2015 12:00 AM - 11/01/2015 11:59 PM As Event_duration and i the first date is event starting date and after '-' is event ending date and i want to echo count of active event so i want to compare end date 11/01/2015 11:59 PM from today date time in my sql query to print in active event count please help me with this what should be the query to find active event count after exploding the date in database after dash '-' please give me the proper solution for this
i m trying this code
它正在产生这个输出: 2015 年 11 月 2 日下午 13:13
<?php
echo $Qry_Act_Count="SELECT SPLIT_STR(Event_Duration, '-', 2) as Active_Event_Time_Show from create_event";
$Act_Event_Count=0;
$Act_Count3=mysqli_query($con,$Qry_Act_Count);
date_default_timezone_set("Asia/Calcutta");
$Act_date = date("m/d/Y H:i A");
while ($Act_Rows=mysqli_fetch_assoc($Act_Count3))
{
echo '<br>' . $Act_date . '>' . $Act_Rows['Active_Event_Time_Show'];
if($Act_date <= $Act_Rows['Active_Event_Time_Show']){
echo $Act_Event_Count++;
}
}
?>
【问题讨论】:
-
我认为将您的
event_duration[VARCHAR] 转换为event_start[DATETIME | TIMESTAMP] 和event_end[日期时间 |时间戳]
标签: mysql