Click here to Skip to main content
15,902,636 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
If i use the function the output is:
<%#System.DateTime.Now.Subtract(Convert.ToDateTime(Eval("Date")))%>


Output is:03:06:57.7332500

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

output is: 9

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

output is: 190.628366666667

But i want result if 1 minutes then 1 minutes ago, if 1 hr then 1 hour ago like that.
Example is also in codeproject posted question page. How many times ago the question will be posted. How can i solve this.
please help....
Thanks in advance
Posted
Updated 21-May-11 4:59am
v2
Comments
Smithers-Jones 21-May-11 9:03am    
Instead of starting new questions over and over again, please use "improve question" to add more details.
Sergey Alexandrovich Kryukov 22-May-11 0:30am    
Too many re-posts. Could be finally classified as spam!
--SA

Why do you keep changing your mind ? TotalMinutes, as I said, gives what you asked for last time.

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^]
two seconds with google - with this, you can build any format string you want.
 
Share this answer
 
v2
You can do ths by writing simple logic on your own.
Convert to minutes and if this is greater than 60, divide minutes by 60, round off and display this amount as hours.
 
Share this answer
 
Comments
Christian Graus 21-May-11 9:12am    
The object gives him these values already. He should check if Hours > 0 and if not, just show minutes.

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