Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to select Time using some TimePicker and stored it in database.
how can i do it ? is there time picker exist in asp.net ?
Posted
Updated 17-Sep-11 1:45am
v2
Comments
koolprasad2003 17-Sep-11 7:45am    
make Meaningful

I think you want a TimerPicker control on your page, where user can select his appointment time and you want to save that time in your database.
Ok here is a good control[^] for Asp.Net.

OR you can use three different DropDownList to achieve this, one for hours, one for minutes and one for seconds.
 
Share this answer
 
Comments
vasanthkarthi 14-Sep-11 7:18am    
Yes Exactly
Suresh Suthar 14-Sep-11 8:32am    
You can accept this solution by just clicking on Accept Answer.
(Dont know why its get downvoted?)
C#
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript">
        function TimeToShow() {
            var dt = new Date();            
            var la = document.getElementById("<%= Timer.ClientID %>");
             la.innerHTML = dt.toLocaleTimeString();
            window.setTimeout(TimeToShow, 1000);          
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:label id="Timer" runat="server" text="Timer" xmlns:asp="#unknown"></asp:label>
    <asp:button id="btnStart" runat="server" text="Start" xmlns:asp="#unknown" />   
    </div>
    </form>
</body>
</html>
 
Share this answer
 
Just visit this link it will solve your problem...

http://www.asp.net/community/control-gallery/Item.aspx?i=3221[^]


If you got it then accept my ans as ans and also rate it..
 
Share this answer
 
use GetDate() function in SqlServer and convert it

SQL
SELECT convert(varchar(10), Getdate(), 108)


This will return time in sql server
 
Share this answer
 
Comments
Pravin Patil, Mumbai 14-Sep-11 7:03am    
Why do you need to convert the date to varchar? One can store the date in DateTime datatype in SQL.
Narendra S Patil 14-Sep-11 7:36am    
If datatype is DateTime, then no need to Convert Date to Varchar.
We can use Convert function, when we want to modify date to certain format and to display on screen.
You try this code. This may help you lot

XML
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="text1" runat="server"></asp:TextBox>

    </div>
    </form>
</body>
<script type="text/javascript">
function timedCount()
{
    var dt = new Date();
    //alert(dt.toLocaleTimeString());
    document.getElementById("text1").value = dt.toLocaleTimeString();
    window.setTimeout(timedCount,1000);
}
timedCount();
</script>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900