Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having problem while retrieving date time from sq l database.
I have Column in with datatype as DATE TIME .
I am using java script date time picker in from end to save the date time with option to save the time in 24 hours format.
It getting save in 24 hours format but when i display that record in grid view
the time get converted in 12hours format

for example if i am saving 07/05/2012 17:35:00
if i am displaying the record in grid view or Text Box it show 07/05/2012 5:35:0 pm
i don't what this can any one help me with this any solution or code
i am trying but not getting success .

Thanks in advance
Posted
Comments
Sandeep Mewara 8-May-12 10:44am    
Does that mean that in your Javascript datetime picker you have the desired date format?

1 solution

Try this :

ASP.NET
<asp:boundfield datafield="Your_Date_Column" dataformatstring="{0:dd/MM/yyyy HH:mm}" htmlencode="false" xmlns:asp="#unknown" />


You need to put that htmlencode attribute.
HTML-encoding field values helps to prevent cross-site scripting attacks and malicious content from being displayed. This property should be enabled whenever possible.
 
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