473,396 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

need the time, not datetime

hello, i need some help with getting time out of a mysql db.

I have a page that lets you enter in your name and submit to a mysql db. In the db the table row is called appt_time and has a Datatype of TIME, with default value of '00:00:00'. this works fine to get the time the record is entered, I do not need the date at all. A sample of the data is 'G .Beck', 14:30:00

Then i have a seperate page that gets this data, but the time suddenly has todays date attached, becoming '8/11/2009 2:30 PM'. I can remove todays date with something like
Expand|Select|Wrap|Line Numbers
  1. (replace(rs("Appt_Time"),d_today,"") 
but this results in ' 2:30 PM', note the white space in the front of the time, it is messing all manner of other things up and is therefore not acceptable.

How do i just get just '2:30 PM' on my page?


Thanks
Aug 11 '09 #1
8 2967
GazMathias
228 Expert 128KB
Hi,

Here's one way:

Expand|Select|Wrap|Line Numbers
  1. intSpace = instr(rs("Appt_Time")," ")
  2.  
  3. Appt_Time = TimeValue(right(rs("Appt_Time"),len(rs("Appt_Time"))-intSpace))
  4.  
  5. Response.Write Appt_Time
  6.  
There are other methods but there isn't an SQL Server app where I am at the moment that I can play with.

Gaz
Aug 12 '09 #2
I need more help with this issue:

In my mySQL db my column has type of TIME. When I enter a time the DB records it as ‘14:30:00’. When my asp page calls it and it becomes ‘10/09/2009 2:30:00 PM’. I use GazMathias’s code and replace the PM/AM to get ‘2:30:00’.
The problem is that if a user edits/updates the data on the page, the time gets recorded as ’02:30:00’ note that this is now AM, not PM.

How do I get around this?
Oct 8 '09 #3
CroCrew
564 Expert 512MB
Hello Path9898,

Use the "FormatDateTime" function.

<%Response.Write(formatdatetime(Now(), 4))%>

Post your code if you need more help. That way our examples can fit within your code better.

Hope that helps,
CroCrew~
Oct 9 '09 #4
CroCrew, thanks for the reply, I hope this all makes sence.

here is the script I to determine the time on the local PC rather then the server time
Expand|Select|Wrap|Line Numbers
  1. <script type = "text/JavaScript"> 
  2. function addTimeOption() 
  3.     { 
  4.     var customer_arrivaltime = document.FRMadd_customer.customer_arrivaltime; 
  5.     var thetime; 
  6.     var d = new Date(); 
  7.     thetimeFull = d.toLocaleTimeString()
  8.     thetimeStripped = d.toLocaleTimeString().replace(" AM", "").replace(" PM", "");
  9.      var newOptn = document.createElement("OPTION"); 
  10.     newOptn.text = thetimeFull; 
  11.     NewOptn.value = thetimeStripped; 
  12.     newOptn.selected = true; 
  13.     customer_arrivaltime.options.add(newOptn); 
  14.         } 
  15. </script> 
it gets added to the botom of a drop down list of times that are formatted like this
Expand|Select|Wrap|Line Numbers
  1.         <option value="18:30:00">6:30 PM</option>
and gets submitted to the database as ‘10/09/2009 2:30:00 PM’

this is how the data is displayed on webpage
Expand|Select|Wrap|Line Numbers
  1. <%    sqlstmt = "SELECT Customer_Name, tbl_lmz_Advisor_Names.advisor_name, tbl_lmz_Advisor_Names.advisor_phone, customer_arrivaltime, customer_departtime FROM tbl_lmz_service_waiters, tbl_lmz_Advisor_Names WHERE tbl_lmz_service_waiters.business_GUID='"& URLBusiness_GUID &"' AND tbl_lmz_Advisor_Names.advisor_GUID = tbl_lmz_service_waiters.customer_advisorGUID ORDER BY customer_departtime ASC;"
  2.  
  3.         rs.open sqlstmt, conn, 1
  4.         Do while not Rs.EOF
  5.                 strCustomer_Name                = rs("Customer_Name")
  6.                 stradvisor_name                    = rs("advisor_name")
  7.                 stradvisor_phone                = rs("advisor_phone")
  8.                   intSpace = instr(rs("customer_arrivaltime")," ") 
  9.                 strcustomer_arrivaltime =  replace(TimeValue(right(rs("customer_arrivaltime"),len(rs("customer_arrivaltime"))-intSpace)),":00 "," ")
  10.                   intSpace = instr(rs("customer_departtime")," ") 
  11.                 strcustomer_departtime =  replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
  12.                 %>
  13.                 <tr>
  14.                 <td align="center" ><b><%=strCustomer_Name %></b></td>
  15.                 <td align="center" ><%=stradvisor_name %></td>
  16.                 <td align="center" ><%=stradvisor_phone %></td>
  17.                 <td align="center" ><%=strcustomer_arrivaltime %></td>
  18.                 <td align="center" ><%=strcustomer_departtime %></td>
  19.  
  20.                 </tr>
  21.          <%      Rs.MoveNext
  22.            loop
  23.            rs.close
  24.         %>
  25.  
  26.  
It is displayed as '2:30 PM’

the problem is that if the data is edited on a seperate page,
Expand|Select|Wrap|Line Numbers
  1. <% Dim strcustomer_departtime        : strcustomer_departtime    = replace(replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace))," AM","")," PM","")
  2.   intSpace = instr(rs("customer_departtime")," ") 
  3. Dim strStrippeddeparttime        : strStrippeddeparttime        = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ") %>
  4.  
  5. <select name="customer_departtime">
  6. <option value="<%= strcustomer_departtime %>" Selected><%= strStrippeddeparttime %></option> 
  7. <option value="01:03:00">other options</option>
  8. <option value="01:04:00">more options</option>
  9. </select>
  10.  
it gets formatted to get it back into datetime format and is resaved in the database as '02:30:00'

how do i display it as 2:30 PM, but automatically make sure that it is saved as 14:30:00?
Oct 15 '09 #5
CroCrew
564 Expert 512MB
Hello Path9898,

I am failing to understand why you are doing this.

Is this a three page solution?

Do the time values that go into the “Options” come from a database query?

But here is a way to do what you’re asking:
Expand|Select|Wrap|Line Numbers
  1. <%
  2.     Response.Write(Replace(formatdatetime(Hour(Now()) & ":" & Minute(Now()), 3),":00 "," "))
  3.     Response.Write("<br />")
  4.     Response.Write(formatdatetime(Hour(Now()) & ":" & Minute(Now()), 4) & ":00")
  5. %>
  6.  
Hope this helps,
CroCrew~
Oct 15 '09 #6
It is a 3 page solution to show appointment times for customers. The first page (add.asp) to enter to the data, a second (edit.asp) to update the data and the third to display (display.asp) the page on a screen in a public area.
The selected value in the option field does come from the database row time value, but additional appointment times are available as options in case an appointment time must be adjusted to an earlier or later time.

This all worked great until 2 things happened:
1) I was running it on MS SQL and it handled time formatting a lot smother then mySQL seems to.
2) I was using the server time (Central time zone) to enter the appointment time on add.asp. Then I ended up with a customer on Eastern Time so the submitted times were an hour out.
ever since these events i have been hacking my way around the time field trying to get a smooth way of doing this.

I do not understand how / where to use the code you have provided. I think you are saying that it should be on add.asp, but then it will be server local time right?
Oct 15 '09 #7
CroCrew
564 Expert 512MB
Hello Path9898,

Can you post the code for all three pages? It would help in getting you a solution to your problem.

CroCrew~
Oct 16 '09 #8
CroCrew, here are the 3 pages. thanks

add.asp
Expand|Select|Wrap|Line Numbers
  1. <%@ Language = "VBScript"%>
  2.  
  3. <!--#include file="ops/inc_connectionstring.asp"-->
  4.  
  5. <%
  6. Dim lngRecsAffected
  7. Dim strSQL
  8. Dim strcustomer_name
  9. Dim strcustomer_helpername
  10. Dim strcustomer_helperphone
  11. Dim strcustomer_departtime
  12. Dim strcustomer_arrivaltime
  13. Dim URLBusiness_GUID        : URLBusiness_GUID                 = request.querystring("DealerGUID")
  14. %>
  15.             <% 'script to determine the time on the local PC rather then the server time
  16.                                     ' note    newOptn.text = "Here Now"; this can contain text instead of the time. %>
  17.                                             <script type = "text/JavaScript"> 
  18.                                             function addTimeOption() 
  19.                                             { 
  20.                                             var customer_arrivaltime = document.FRMadd_customer.customer_arrivaltime; 
  21.                                             var thetime; 
  22.                                             var d = new Date(); 
  23.                                             thetimeFull = d.toLocaleTimeString()
  24.                                             thetimeStripped = d.toLocaleTimeString().replace(" AM", "").replace(" PM", "");
  25.  
  26.                                             var newOptn = document.createElement("OPTION"); 
  27.                                             newOptn.text = thetimeFull; 
  28.                                             newOptn.value = thetimeStripped; 
  29.                                             newOptn.selected = true; 
  30.                                             customer_arrivaltime.options.add(newOptn); 
  31.                                             } 
  32.                                             </script> 
  33.                                     <% 'end script to determine the time on the local PC %>
  34.  
  35. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  36. <html>
  37. <head>
  38. <title>Zone - Add A New Waiter</title>
  39. <link rel="stylesheet" href="<%= strURL %>/site.css" type="text/css">
  40. <link rel="shortcut icon" href="favicon.ico">
  41. <meta http-equiv="refresh" content="600">
  42.                                     </head>
  43. <BODY class="page_bg" onLoad="addTimeOption(); ">
  44.  
  45.  
  46.  
  47.         <table class="management_tables_border" align="center">
  48.  
  49. <tr><td>
  50.         <table>
  51.         <tr><td>Enter your waiting customer's name in the format of first intial last name. 
  52.         <br>Your local time will appear at the top of the 'Select Time In:' list, you can change it if the customer arrived some time ago.<br><br>
  53.         </td></tr>
  54.         </table>
  55. </td></tr>
  56.  
  57. <tr><td>
  58.  
  59. <table align="center" height="100%" bgcolor="white" width="100%" >
  60. <form name="FRMadd_customer" method="post"  onsubmit="return Form_Validator(this)">
  61. <input type="hidden" name="action" value="Save Form Data">
  62.  
  63.  
  64.             <%
  65.             ' See if we have any info to process.
  66.             If Request.Form("action") <> "Save Form Data" and strTo = "" Then
  67.                 ' Show the form
  68.                 %>
  69.  
  70.     <tr>
  71.     <td class="body" align="right" width="180"><strong>Enter Customer Name:</strong></td>
  72.     <td><input type="text" maxlength="15" rows="1" name="Customer_Name" size="16"></td>
  73.     </tr>
  74.  
  75.  
  76.                 <tr>
  77.                 <td class="body" align="right"><strong>Select a helper:</strong></td>
  78.                     <%
  79.                             ' get the name and phone number of the helper out of the DB to save user input
  80.                         sqlstmt = "SELECT DISTINCT helper_GUID, helper_name, helper_phone FROM tbl_z1_helper_Names WHERE business_GUID='"& URLBusiness_GUID &"' ORDER BY helper_name ASC;"
  81.         '' if no helpers exist the customer_add.asp will crap out.
  82.                            rs.open sqlstmt, conn, 1
  83.                                 Dim strhelper_name            : strhelper_name              = rs("helper_name") 
  84.                                 Dim strhelper_phone        : strhelper_phone              = rs("helper_phone") 
  85.                                 Dim strhelper_GUID            : strhelper_GUID              = rs("helper_GUID") 
  86.                         response.write "<td>"
  87.                         response.write "<SELECT id=""helper"" name=""Get_helper_GUID"" size=""1"">"
  88.  
  89.                             Do while not Rs.EOF
  90.                                 Response.Write("<option value=""" & rs("helper_GUID") & "$" & rs("helper_name") & """>" & rs("helper_name") & "</option>")
  91.                               Rs.MoveNext
  92.                            loop
  93.                         response.write "</SELECT>"                    response.write "</td>"
  94.                         rs.Close
  95.                         %>
  96.                 </tr>
  97.         <tr>
  98.         <td class="body" align="right"><strong>Select Time In:</strong></td>
  99.         <td>
  100.             <select name="customer_arrivaltime">
  101.             <option value="5:30:00">5:30 AM</option>             <option value="5:45:00">5:45 AM</option>
  102.             <option value="6:00:00">6:00 AM</option>            <option value="6:15:00">6:15 AM</option>
  103.             <option value="6:30:00">6:30 AM</option>            <option value="6:45:00">6:45 AM</option>
  104.             <option value="7:00:00">7:00 AM</option>            <option value="7:15:00">7:15 AM</option>
  105.             <option value="7:30:00">7:30 AM</option>            <option value="7:45:00">7:45 AM</option>
  106.             <option value="8:00:00">8:00 AM</option>            <option value="8:15:00">8:15 AM</option>
  107.             <option value="8:30:00">8:30 AM</option>            <option value="8:45:00">8:45 AM</option>
  108.             <option value="9:00:00">9:00 AM</option>            <option value="9:15:00">9:15 AM</option>
  109.             <option value="9:30:00">9:30 AM</option>            <option value="9:45:00">9:45 AM</option>
  110.             <option value="10:00:00">10:00 AM</option>            <option value="10:15:00">10:15 AM</option>
  111.             <option value="10:30:00">10:30 AM</option>            <option value="10:45:00">10:45 AM</option>
  112.             <option value="11:00:00">11:00 AM</option>            <option value="11:15:00">11:15 AM</option>
  113.             <option value="11:30:00">11:30 AM</option>            <option value="11:45:00">11:45 AM</option>
  114.             <option selected="selected" value="12:00:00">12:00 PM</option>            <option value="12:15:00">12:15 PM</option>
  115.             <option value="12:30:00">12:30 PM</option>            <option value="12:45:00">12:45 PM</option>
  116.             <option value="13:00:00">1:00 PM</option>                <option value="13:15:00">1:15 PM</option>
  117.             <option value="13:30:00">1:30 PM</option>                <option value="13:45:00">1:45 PM</option>
  118.             <option value="14:00:00">2:00 PM</option>                <option value="14:15:00">2:15 PM</option>
  119.             <option value="14:30:00">2:30 PM</option>                <option value="14:45:00">2:45 PM</option>
  120.             <option value="15:00:00">3:00 PM</option>                <option value="15:15:00">3:15 PM</option>
  121.             <option value="15:30:00">3:30 PM</option>                <option value="15:45:00">3:45 PM</option>
  122.             <option value="16:00:00">4:00 PM</option>                <option value="16:15:00">4:15 PM</option>
  123.             <option value="16:30:00">4:30 PM</option>                <option value="16:45:00">4:45 PM</option>
  124.             <option value="17:00:00">5:00 PM</option>                <option value="17:15:00">5:15 PM</option>
  125.             <option value="17:30:00">5:30 PM</option>                <option value="17:45:00">5:45 PM</option>
  126.             <option value="18:00:00">6:00 PM</option>                <option value="18:15:00">6:15 PM</option>
  127.             <option value="18:30:00">6:30 PM</option>                <option value="18:45:00">6:45 PM</option>
  128.             <option value="19:00:00">7:00 PM</option>                <option value="19:15:00">7:15 PM</option>
  129.             <option value="19:30:00">7:30 PM</option>                <option value="19:45:00">7:45 PM</option>
  130.             <option value="20:00:00">8:00 PM</option>
  131.             </select>        
  132.         </td>        
  133.     </tr>
  134.     <tr>
  135.         <td class="body" align="right"><strong>Select  Est. Time Out:</strong></td>
  136.         <td>
  137.             <select name="customer_departtime">
  138.             <option value="5:30:00">5:30 AM</option>             <option value="5:45:00">5:45 AM</option>
  139.             <option value="6:00:00">6:00 AM</option>            <option value="6:15:00">6:15 AM</option>
  140.             <option value="6:30:00">6:30 AM</option>            <option value="6:45:00">6:45 AM</option>
  141.             <option value="7:00:00">7:00 AM</option>            <option value="7:15:00">7:15 AM</option>
  142.             <option value="7:30:00">7:30 AM</option>            <option value="7:45:00">7:45 AM</option>
  143.             <option value="8:00:00">8:00 AM</option>            <option value="8:15:00">8:15 AM</option>
  144.             <option value="8:30:00">8:30 AM</option>            <option value="8:45:00">8:45 AM</option>
  145.             <option value="9:00:00">9:00 AM</option>            <option value="9:15:00">9:15 AM</option>
  146.             <option value="9:30:00">9:30 AM</option>            <option value="9:45:00">9:45 AM</option>
  147.             <option value="10:00:00">10:00 AM</option>            <option value="10:15:00">10:15 AM</option>
  148.             <option value="10:30:00">10:30 AM</option>            <option value="10:45:00">10:45 AM</option>
  149.             <option value="11:00:00">11:00 AM</option>            <option value="11:15:00">11:15 AM</option>
  150.             <option value="11:30:00">11:30 AM</option>            <option value="11:45:00">11:45 AM</option>
  151.             <option selected="selected" value="12:00:00">12:00 PM</option>            <option value="12:15:00">12:15 PM</option>
  152.             <option value="12:30:00">12:30 PM</option>            <option value="12:45:00">12:45 PM</option>
  153.             <option value="13:00:00">1:00 PM</option>                <option value="13:15:00">1:15 PM</option>
  154.             <option value="13:30:00">1:30 PM</option>                <option value="13:45:00">1:45 PM</option>
  155.             <option value="14:00:00">2:00 PM</option>                <option value="14:15:00">2:15 PM</option>
  156.             <option value="14:30:00">2:30 PM</option>                <option value="14:45:00">2:45 PM</option>
  157.             <option value="15:00:00">3:00 PM</option>                <option value="15:15:00">3:15 PM</option>
  158.             <option value="15:30:00">3:30 PM</option>                <option value="15:45:00">3:45 PM</option>
  159.             <option value="16:00:00">4:00 PM</option>                <option value="16:15:00">4:15 PM</option>
  160.             <option value="16:30:00">4:30 PM</option>                <option value="16:45:00">4:45 PM</option>
  161.             <option value="17:00:00">5:00 PM</option>                <option value="17:15:00">5:15 PM</option>
  162.             <option value="17:30:00">5:30 PM</option>                <option value="17:45:00">5:45 PM</option>
  163.             <option value="18:00:00">6:00 PM</option>                <option value="18:15:00">6:15 PM</option>
  164.             <option value="18:30:00">6:30 PM</option>                <option value="18:45:00">6:45 PM</option>
  165.             <option value="19:00:00">7:00 PM</option>                <option value="19:15:00">7:15 PM</option>
  166.             <option value="19:30:00">7:30 PM</option>                <option value="19:45:00">7:45 PM</option>
  167.             <option value="20:00:00">8:00 PM</option>    
  168.             </select>        
  169.         </td>    
  170.     </tr>    
  171.     <tr>
  172.         <td></td>
  173.         <td><input type="submit" name="SubmitAction" value="Add this Customer" onClick="(document.all.customer_arrivaltime.options[document.all.customer_arrivaltime.selectedIndex].value)"></td>
  174.     </tr>
  175.  
  176.     </table>
  177.     </form>
  178.  
  179. </td></tr>
  180. </table>
  181.  
  182. <%
  183. Else
  184.  
  185. 'get the helper details from the dropdown and split out the name from the guid for seperate db fields. 
  186. Dim s1, strhelper_GUID1, strhelper_Name1 
  187. s1 = Request("Get_helper_GUID") 
  188. If InStr(s1, "$") > 0 Then 
  189.     strhelper_GUID1 = Split(s1, "$")(0) 
  190.     strhelper_Name1= Split(s1, "$")(1) 
  191. End If 
  192.  
  193.     strCustomer_Name                = Replace(Request.Form("Customer_Name"),"'","''")
  194.     strcustomer_arrivaltime            = Request.Form("customer_arrivaltime")
  195.     strcustomer_departtime            = Request.Form("customer_departtime")            
  196.  
  197.         ' Build our SQL String
  198.         strSQL = ""
  199.         strSQL = strSQL & "INSERT INTO tbl_z1_service_waiters "
  200.         strSQL = strSQL & "(gCustomer_ID, Customer_Name, customer_helperGUID, customer_arrivaltime, customer_departtime, business_GUID, creation_date, customer_helper_name) " & vbCrLf
  201.         strSQL = strSQL & "VALUES ("
  202.         strSQL = strSQL & "UUID()"
  203.         strSQL = strSQL & ", "
  204.         strSQL = strSQL & "'" & strCustomer_Name & "'"
  205.         strSQL = strSQL & ", "
  206.         strSQL = strSQL & "'" & strhelper_GUID1 & "'"
  207.         strSQL = strSQL & ", "
  208.         strSQL = strSQL & "'" & strcustomer_arrivaltime & "'"
  209.         strSQL = strSQL & ", "
  210.         strSQL = strSQL & "'" & strcustomer_departtime & "'"
  211.         strSQL = strSQL & ", "
  212.         strSQL = strSQL & "'" & URLBusiness_GUID & "'"
  213.         strSQL = strSQL & ", "
  214.         strSQL = strSQL & "now()"
  215.         strSQL = strSQL & ", "
  216.         strSQL = strSQL & "'" & strhelper_Name1 & "'"
  217.         strSQL = strSQL & ");"
  218.  
  219.         conn.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords
  220.  
  221. Response.redirect strURL & "/control/waiter_manage_list.asp?DealerGUID=" & URLBusiness_GUID 
  222.  
  223. End If
  224. %>
  225.  
  226. </body>
  227.     </html>
  228.  

edit.asp

Expand|Select|Wrap|Line Numbers
  1. <%@ Language = "VBScript"%>
  2. <!--#include file="ops/inc_connectionstring.asp"-->
  3.  
  4. <%
  5. Dim lngRecsAffected
  6. Dim strSQL
  7. Dim URLBusiness_GUID        : URLBusiness_GUID                 = request.querystring("DealerGUID")
  8. Dim URLgCustomer_ID            : URLgCustomer_ID                 = request.querystring("CustGUID")
  9.  
  10.     sqlstmt = "SELECT Customer_Name, tbl_z1_helper_Names.helper_GUID, tbl_z1_helper_Names.helper_name, customer_departtime, gCustomer_ID, tbl_z1_service_waiters.business_GUID FROM tbl_z1_service_waiters, tbl_z1_helper_Names WHERE tbl_z1_service_waiters.gCustomer_ID='"& URLgCustomer_ID &"' AND tbl_z1_helper_Names.helper_GUID = tbl_z1_service_waiters.Customer_helperGUID;"
  11.  
  12. rs.open sqlstmt, conn, 1
  13.    If not rs.eof then
  14. Dim strcustomer_name                    : strcustomer_name                    = rs("customer_name")
  15. Dim strhelper_name                        : strhelper_name                    = rs("helper_name")
  16. Dim strhelper_GUID                        : strhelper_GUID                    = rs("helper_GUID")
  17.  
  18. Dim strcustomer_departtime        : strcustomer_departtime    = replace(replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace))," AM","")," PM","")
  19.   intSpace = instr(rs("customer_departtime")," ") 
  20. Dim strStrippeddeparttime        : strStrippeddeparttime        = replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
  21.  
  22. Dim strgCustomer_ID                        : strgCustomer_ID                    = Rs("gCustomer_ID")
  23. Dim strgBusiness_GUID                    : strgBusiness_GUID                    = Rs("Business_GUID")
  24.     End If
  25. %>
  26.  
  27. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
  28. <html>
  29. <head>
  30. <title>Zone - Edit <%= strcustomer_name %>'s details</title>
  31. <link rel="stylesheet" href="<%= strURL %>/site.css" type="text/css">
  32. <link rel="shortcut icon" href="favicon.ico">
  33. <meta http-equiv="refresh" content="0600">
  34. </head>
  35. <body class="page_bg">
  36.  
  37.  
  38.         <table class="management_tables_border" align="center">
  39. <tr><td>
  40.         <table>
  41.         <tr><td>Enter your waiting customer's name in the format of first intial last name. 
  42.         </td></tr>
  43.         </table>
  44. </td></tr>
  45.  
  46. <tr><td>
  47. <table align="center" height="100%"  width="100%" >
  48.  
  49. <form name="frmEdit" method="post">
  50. <input type="hidden" name="action" value="Save Form Data">
  51.  
  52.                 <%
  53.                 ' See if we have any info to process.
  54.                 If Request.Form("action") <> "Save Form Data" and strTo = "" Then
  55.                     ' Show the form
  56.                     %>
  57.  
  58.     <tr>
  59.         <td class="body" align="right"  width="180"><strong>Enter Customer Name:</strong></td>
  60.         <td><input type="text" maxlength="15" rows="1" name="customer_name" size="16" value="<%=strcustomer_name%>"></td>
  61.     </tr>
  62.                 <tr>
  63.                 <td class="body" align="right"><strong>Select a helper:</strong></td>
  64.                 <td><input type="text" maxlength="15" rows="1" readonly name="helper_name" size="16" value="<%=strhelper_name%>"></td>
  65.                 </tr>        
  66.  
  67.     <tr>
  68.         <td class="body" align="right"><strong>Select Est. Time Out:</strong></td>
  69.         <td>
  70.             <select name="customer_departtime">
  71.                                             <% If strcustomer_departtime = "1:01:00" Then %>
  72.                                                             <option value="<%= strcustomer_departtime %>" Selected>Ready!!</option> 
  73.                                             <% ElseIf strcustomer_departtime = "1:02:00" Then  %>
  74.                                                             <option value="<%= strcustomer_departtime %>" Selected>Washing </option> 
  75.                                             <% ElseIf strcustomer_departtime = "1:03:00" Then   %>
  76.                                                             <option value="<%= strcustomer_departtime %>" Selected>See helper</option> 
  77.                                             <% Else  %>
  78.                                                             <option value="<%= strcustomer_departtime %>" Selected><%= strStrippeddeparttime %></option> 
  79.                                             <% End If %>
  80.             <% 'custom messages %>
  81.             <option value="01:03:00">See helper</option>
  82.             <option value="01:02:00">Washing</option>
  83.             <option value="01:01:00">Ready!!</option>
  84.             </select>        
  85.         </td>
  86.     </tr>
  87.  
  88.     <tr>
  89.         <td></td>
  90.         <td><input type="submit" name="SubmitAction" value="Update this Customer"></td>
  91.     </tr>
  92. </table>
  93.     </form>
  94.  
  95.  
  96. <%
  97. Else
  98.     ' Do our DB insert!
  99.     strcustomer_name                = Replace(Request.Form("customer_name"),"'","''")
  100.     strcustomer_departtime            = Request.Form("customer_departtime")
  101.  
  102.         ' Build our SQL String
  103.         strSQL = ""
  104.         strSQL = strSQL & "UPDATE tbl_z1_service_waiters "
  105.         strSQL = strSQL & "SET customer_name ='" & strcustomer_name & "'"
  106.         strSQL = strSQL & ", "
  107.         strSQL = strSQL & "customer_departtime ='" & strcustomer_departtime & "'"
  108.         strSQL = strSQL & "Where gCustomer_ID = '"
  109.         strSQL = strSQL & URLgCustomer_ID
  110.         strSQL = strSQL & "';"
  111.  
  112.         conn.Execute strSQL, lngRecsAffected, adCmdText Or adExecuteNoRecords
  113.  
  114. response.redirect strURL & "/control/waiter_manage_list.asp?DealerGUID=" & URLBusiness_GUID 
  115.     End If 
  116.  
  117. %>
  118.  
  119. </body>
  120. </html>
  121.  
display.asp
Expand|Select|Wrap|Line Numbers
  1.         <table class="display_table" cellspacing="1" cellpadding="3" valign="middle" align="center">
  2.                     <tr class="displayscreen_col_header" > 
  3.                         <td>Customer</td>
  4.                         <td>helper</td>
  5.                         <td>Extension</td>
  6.                         <td>Time In</td>
  7.                         <td>Est. Time Out</td>
  8.                     </tr>
  9.         <%
  10.     sqlstmt = "SELECT Customer_Name, tbl_z1_helper_Names.helper_name, tbl_z1_helper_Names.helper_phone, customer_arrivaltime, customer_departtime FROM tbl_z1_service_waiters, tbl_z1_helper_Names WHERE tbl_z1_service_waiters.business_GUID='"& URLBusiness_GUID &"' AND tbl_z1_helper_Names.helper_GUID = tbl_z1_service_waiters.customer_helperGUID ORDER BY customer_departtime ASC;"
  11.  
  12.         rs.open sqlstmt, conn, 1
  13.         Do while not Rs.EOF
  14.                 strCustomer_Name                = rs("Customer_Name")
  15.                 strhelper_name                    = rs("helper_name")
  16.                 strhelper_phone                = rs("helper_phone")
  17.                   intSpace = instr(rs("customer_arrivaltime")," ") 
  18.                 strcustomer_arrivaltime =  replace(TimeValue(right(rs("customer_arrivaltime"),len(rs("customer_arrivaltime"))-intSpace)),":00 "," ")
  19.                   intSpace = instr(rs("customer_departtime")," ") 
  20.                 strcustomer_departtime =  replace(TimeValue(right(rs("customer_departtime"),len(rs("customer_departtime"))-intSpace)),":00 "," ")
  21.                 %>
  22.                 <tr>
  23.                 <td><b><%=strCustomer_Name %></b></td>
  24.                 <td><%=strhelper_name %></td>
  25.                 <td><%=strhelper_phone %></td>
  26.                 <td><%=strcustomer_arrivaltime %></td>
  27.                 <td><% If strcustomer_departtime = "1:01 AM" Then 
  28.                                                     response.write ("<font color=""#339933"">Ready!!</font></td>")
  29.                                                          elseIf strcustomer_departtime = "1:02 AM" Then 
  30.                                                     response.write ("<font color=""#0000ff"">Washing</font></td>")
  31.                                                         elseIf strcustomer_departtime = "1:03 AM" Then 
  32.                                                     response.write ("<font color=""#cc0000"">See helper</font></td>")
  33.                                                         else response.write strcustomer_departtime & "</td>"
  34.                                                         End If  %>
  35.                 </tr>
  36.          <%      Rs.MoveNext
  37.            loop
  38.            rs.close
  39.         %>
  40.         </table>
  41.  
  42.  
Oct 20 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: nephish | last post by:
Hey there, i am doing a plotting application. i am using mxRelativeDateTimeDiff to get how much time is between date x and date y now what i need to do is divide that time by 20 to get 20 even...
2
by: A Programmer | last post by:
I can't believe I have never run into this before but, I have an object that has a property of type DateTime. A collection of these objects are used to populate my DataGrid. In DateTime format they...
30
by: nephish | last post by:
Hey there, i have tried about every graphing package for python i can get to work on my system. gnuplot, pychart, biggles, gdchart, etc.. (cant get matplot to work) so far, they all are working...
5
by: The Pig | last post by:
Got a table. Date Time Code 1/1/2003 1700 xbc 1/1/2003 1800 xbc 1/1/2003 1800 xbc 2/4/2004 1650 abc 2/4/2004 1700 abc The problem is I need a...
3
by: Jon Davis | last post by:
The date string: "Thu, 17 Jul 2003 12:35:18 PST" The problem: // this fails on PST DateTime myDate = DateTime.Parse("Thu, 17 Jul 2003 12:35:18 PST"); Help? Jon
7
by: Bruce D | last post by:
My program in connecting to a web site and I want to know how long it takes to connect to this site. I'm assuming I need to use some sort of timer. This is a console application. Here are the...
4
by: Maziar Aflatoun | last post by:
Hi, Can someone please tell me how I can set DateTime to 01/01/1970 (UTC). Doing the following DateTime dt1 = new DateTime(1970, 1,1); Debug.WriteLine("dt1(utc):"+...
12
by: colincolehour | last post by:
I am new to Python and am working on my first program. I am trying to compare a date I found on a website to todays date. The problem I have is the website only shows 3 letter month name and the...
4
by: trint | last post by:
I need to get the time from NOW and get how many milleseconds until 1:00am for my countdown timer please. Any help is appreciated. Thanks, Trint
9
by: Ron Adam | last post by:
I'm having some cross platform issues with timing loops. It seems time.time is better for some computers/platforms and time.clock others, but it's not always clear which, so I came up with the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.