There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen blue screen of death boot computer connection crash css dell display driver drivers error firefox firefox 3 game hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express partition password printer problem problems ram router security slow software sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Time format in mysql and asp


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
judo2000's Avatar
Junior Member with 1 posts.
 
Join Date: Nov 2004
Experience: Intermediate
17-Nov-2004, 05:31 PM #1
Time format in mysql and asp
Hi, I have a database with a record named classes. One of the fields in the record is time set to type time in a mysql database. I am trying to call a list of classes based on the time of day, for example if it is 4 p.m. I want to list all classes that are on today at 4 p.m. or later. I want to list the first three in one colum and the second three in the second column. The code I have now will list the class names but shows nothing. The time is listed in the database as default format 00:00:00 but I am trying to get it to show as 4:00 p.m. or even 4:00 PM. Below is the code I have:

<%
rs.Open "SELECT classes.classID, classes.classType, classes.className, classes.day, TIME_FORMAT(classes.time,'%h:%i %p') as classTime 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 = classTime
id = rs("classID")
ELSE
END if
response.Write("<span class='headBox'> " & rs("className") & ": </span> " & classTime & "<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
if NOT lastTime ="" THEN
DO WHILE rs.EOF
if NOT rs("time") ="" AND 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
ELSE
END if
rs.Close
%>
</td>

Any help would be greatly appreciated!

judo2000
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 05:11 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.