Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2005, 06:44 PM
Authorized User
 
Join Date: Dec 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying time in chronological order

have database with field where users can enter the schedule time of an event. however, i am using sql server and have field set up as varchar datatype right now. how can i use an actual datetime field where i could only display the time using ASP. this is my code.

Sql = "SELECT dte, eTime, cnumber, text_field, pltatty, defatty, etype "
Sql = Sql & "FROM diary "
Sql = Sql & "WHERE dte= '" & dt & "' "
Sql = Sql & "ORDER BY etime ASC"
objRs.Open Sql, objConn


Do While Not objRs.EOF
Response.Write "<tr>"
Response.Write "<td valign=top align=left>" & "" & objRs("etime") & "<p>&nbsp;</p><p>&nbsp;</p>" & "</td><td valign=top align=left>" & ""
Response.Write "" & objRs("cnumber") & "</td><td valign=top align=left>" & ""
Response.Write "" & objRs("text_field") & "</td><td valign=top align=left>" & ""
Response.Write "" & objRs("pltatty") & "</td><td valign=top align=left>" & ""
Response.Write "" & objRs("defatty") & " </td><td valign=top align=left>" & ""
Response.Write "" & objRs("etype") & "<BR><BR></td><td valign=top align=left>" & "" & vbcrlf
Response.Write "</tr>"
objRs.MoveNext
Loop

Mike
__________________
Mike
 
Old January 21st, 2005, 09:11 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Hi,

 Do you want to convert the varchar field in your database as datetime and display in ASP only time..?

If yes then you can use formatdatetime function to display only time from datetime.

Om Prakash
 
Old January 21st, 2005, 10:26 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

The below code displays the time alone. Replace getdate() with your datetime field name.

Select Convert(char(10), getdate(), 114)

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 24th, 2005, 02:11 PM
Authorized User
 
Join Date: Dec 2004
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks vladivel/om_prakash, used formatdatetime and it worked.
thanks a bunch.

Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem displaying records in order of time ,date method PHP Databases 3 July 25th, 2006 08:16 PM
1. Subform = String, Chronological Date order nbuckwheat Access 2 December 21st, 2005 06:50 PM
Error - Not Displaying time jzycn2 ASP.NET 1.0 and 1.1 Basics 2 October 18th, 2005 01:32 PM
displaying date and time harpua Classic ASP Databases 2 October 29th, 2004 09:16 PM
Urgent Displaying record in Horizantal order qazi_nomi Classic ASP Basics 1 July 14th, 2004 04:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.