Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wanna Bind 09:00 AM in my textbox(<MaskEditExtender>) from database(stored as 09:00:00)...how to do this ..?.........OR any other way to do this process
Posted
Updated 16-May-14 20:07pm
v2

1 solution

Do like below.

timeTextBox.Text=myDateTime.ToString("hh:mm tt");


"tt" is identifier for AM/PM.
 
Share this answer
 
Comments
phmani469 19-May-14 1:15am    
Dude i tried urs...but it showing the error like
Return a Stystem.String that represents the current System Object
Error
No overload for method ToString takes 1 argument
Actually Im binding like below
txtGrace.Text = dt.Rows[0]["GraceTime"].ToString("hh:mm tt");
Sanjay K. Gupta 19-May-14 8:45am    
dt.Rows[0]["GraceTime"] will return System.Object. You need to first convert it to DateTime object.

Try this
txtGrace.Text =Convert.ToDateTime(dt.Rows[0]["GraceTime"]).ToString("hh:mm tt");
phmani469 28-May-14 2:55am    
thanks boss

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