Print Page | Close Window

mySQL time format

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=12571
Printed Date: 30 March 2026 at 7:19am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: mySQL time format
Posted By: judo2000
Subject: mySQL time format
Date Posted: 16 November 2004 at 6:34pm
HI,
I have a mySQL database with a table called classes.  One of the fields is "time" type="time".  I have an asp page that calls for classes listed in the class database depending on day and time.  I have a table with two columns.  The first column has the first three cllasses that occur after the current time and the second colum is the next three classes.  It will pull the first three classes but instead of time it gives the current date which is not entered anywhere in the database.   Below is my code.  I would appreciate any help.

<%
    Dim TodayDay, NowTime, lastTime, id
    TodayDay = WeekDayName(WeekDay(date()), false, 1)
    rs.Open "SELECT * FROM classes WHERE classes.day='" & TodayDay & "' AND classes.time >= CURRENT_TIME() ORDER BY classes.time LIMIT 3", conDB
%>
<tr>
    <td width="49%" valign="top" class="bodyTxt">
        <%
            count = 1
            DO WHILE NOT rs.EOF
                if NOT rs.EOF THEN
                    if count = 3 THEN
                        lastTime = rs("time")
                        id = rs("classID")
                        ELSE
                    END if
                    response.Write("<span class='headBox'> " & rs("className") & ": </span> " & rs("time") & "<br>")
                     Else
                END if
                count = count + 1
                rs.MoveNext
            Loop
            rs.Close  
        %>
    </td>
    <td width="2%">&nbsp;</td>
    <td width="49%" valign="top" class="bodyTxt">
        <%
            rs.Open "SELECT * FROM classes WHERE classes.day='" & TodayDay & "' ORDER BY classes.classID LIMIT 4", conDB
            DO WHILE rs.EOF
                if NOT rs("time") >= lastTime AND rs("classID") <> id THEN
                    response.Write("<span class='headBox'> " & rs("className") & ": </span> " & rs("time") & "<br>")
                    Else
                END if
                rs.MoveNext
            Loop   
            rs.Close
        %>
    </td>
</tr>

Thanks,

judo2000


-------------
If you are not willing to work hard to realize your dreams, why bother dreaming?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net