เวลาในการแสดงผลไม่ตรงกับความเป็นจริงแก้ยังไงดีครับ
http://www.onechannelasia.com/live-tv.asp
ผมเอาโค๊ดมาให้ดูด้วยรบกวนผู้รูดูให้หน่อยครับ
คือมันดึงเวลามาแสดงผลเร็วกว่า ครึ่งชั่วโมงเช่วยดูหน่อยครับ
<!--#include file="connection/connect.asp" -->
<!--#include file="admin_manage/common.asp" -->
<%
Program_Date = ConvertDate(date)
Date_Now = FormatDateThai(date)
xtime = right("00" &hour(now),2) & ":" & right("00" &minute(now),2)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Untitled Document</title>
<style type="text/css">
td img {display: block;}body {
margin-top: 0px;
background-color: #333333;
background-attachment: fixed;
background-image: url(asset/bg2.jpg);
background-repeat: no-repeat;
background-position: 100% 100%;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style19 {
font-size: 12px;
font-family: Arial, Helvetica, sans-serif;
color: #FF0000;
}
.style21 {color: #FFFFFF}
.style29 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FF0000; }
a {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #999999;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: none;
color: #999999;
}
a:active {
text-decoration: none;
color: #000000;
}
.style35 {font-family: Arial, Helvetica, sans-serif; font-weight: normal; color: #FF0000; font-size: 12px; }
.style38 {font-family: Arial, Helvetica, sans-serif; font-weight: normal; color: #0099FF; font-size: 12px; }
.style41 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFCC00; font-size: 14px; }
<!--
html {scrollbar-base-color: '#333333'}
-->
</style>
</head>
<body>
<table width="355" border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
<tr>
<td height="30" bgcolor="#666666"><span class="style21"></span></td>
<td colspan="2" align="left" bgcolor="#666666"><span class="style41 style18">รายการกำลังออกอากาศ</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
set rs = server.CreateObject("adodb.recordset")
sql = "select * from Program_Daily where Program_Date=#"&Program_Date&"# and '"&xtime&"' between Start_Time and End_Time order by Program_ID asc"
rs.Open sql,con,1,1
if not rs.EOF then
Program_ID = rs("Program_ID")
%>
<tr>
<td valign="top"> </td>
<td align="left" valign="top"><span class="style19"> <span class="style19"><strong><%=rs("Start_Time")%>-<%=rs("End_Time")%></strong></span></span></td>
<td align="left" valign="top"><span class="style19"><%=rs("Program")%></span></td>
</tr>
<%
end if
rs.close
%>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td height="30" bgcolor="#666666"><span class="style21"></span></td>
<td colspan="2" align="left" bgcolor="#666666"><span class="style41">รายการต่อไป</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
sql = "select * from Program_Daily where Program_Date=#"&Program_Date&"# and '"&xtime&"' <= Start_Time "
if Program_ID <> "" then sql = sql & "and Program_ID <> " & Program_ID & " "
sql =sql & "order by Start_Time,Program_ID asc"
rs.Open sql,con,1,1
if not rs.EOF then
do while not rs.EOF
%>
<tr>
<td width="5%" valign="top"> </td>
<td width="28%" align="left" valign="top"><span class="style38"><%=rs("Start_Time")%>-<%=rs("End_Time")%></span></td>
<td align=left valign="top"><span class="style38"><%=rs("Program")%></span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
rs.MoveNext
loop
end if
rs.close
set rs= nothing
%>
</table>
</body>
</html>
<!--#include file="connection/close_connection.asp" -->Tag : ASP
Date :
2010-12-21 16:03:13
By :
ภัคภณ
View :
1248
Reply :
1
ลองใช้ Response.write Now() ดูครับ ถ้าไม่ตรงแสดงว่าเวลาบน Server ไม่ตรงกับเวลาไทยน่ะครับ อาจจะต้องใช้ DateAdd เข้ามาช่วยครับ
Go to : ASP/VBScript DateAdd()
Date :
2010-12-21 17:40:30
By :
webmaster
Load balance : Server 05