Click here to Skip to main content
15,917,320 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
Please check this code:
<%=System.DateTime.Now%> &"-"& <%# Eval("Submit_date")%>

But it can't difference the date

Please help

Thanks in advance

<%=System.DateTime.Now%> &"-"& <%# Eval("Submit_date")

In this code Submit_date is also in date time format
both date are shown but it can't do the difference
it give the output like this

On 6/8/2011 4:58:58 PM &"-"& 3/26/2011 6:22:17 PM
Posted
Updated 8-Jun-11 1:34am
v4

Hi,

You cant get date difference like the approach you adopted. You have to convert Submit_date field to DateTime before calculating the difference,You can find more details here
http://www.c-sharpcorner.com/UploadFile/DipalChoksi/DateDiff_CS_DC09132006172429PM/DateDiff_CS_DC.aspx[^]

Hope this will help.
 
Share this answer
 
hi,

my advise is better you can do difference date in code behind...
 
Share this answer
 
Comments
rahul dev123 8-Jun-11 8:22am    
I can't do that because i use Eval function
Hope this[^] might help you.
 
Share this answer
 
try this

<%#System.DateTime.Now.Subtract(Convert.ToDateTime(Eval("Submit_date")))%> 


Hope it helps ..:)
 
Share this answer
 
v2

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