Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a timeStartTime(time(7),not null) field in database.

Then i converted it to datetime in code behind as below

Convert.ToDateTime(dr["timeStartTime"].ToString())

Then in aspx page i wrote like this
<%=Html.Encode(item.startTime.Minute)%>

I am getting the minute part like this

as 0 (instead of 00 in 07:00:02)


The minute part is not getting fully.How can i solve this problem?
Posted

<%=Html.Encode(item.startTime.ToString("mm"))%>


Try this.
 
Share this answer
 
Comments
deepak thomas 11-Nov-10 0:41am    
Thanks
Use .ToString("hh:mm:ss")
replace hh with HH (caps) for 24 hr format

You may also add 'tt' .ToString("hh:mm:ss tt") to get AM/PM
 
Share this answer
 
Comments
deepak thomas 11-Nov-10 0:47am    
thanks

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