检查详细代码和输出

检查详细代码和输出

问题描述:

如果我使用该函数,输出为:

If i use the function the output is:

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



输出是:03:06:57.7332500



Output is:03:06:57.7332500

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


输出是:9


output is: 9

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


输出是:190.628366666667

但是我想要结果,如果1分钟然后1分钟前,如果1小时然后1小时前就这样.
示例也在codeproject发布的问题页面中.多少次该问题将被发布.我该如何解决.
请帮忙....
在此先感谢


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

您为什么不断改变主意?正如我所说,TotalMinutes提供了您上次要求的内容.

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx [ ^ ]
用google进行两秒钟-这样,您就可以构建所需的任何格式字符串.
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.


您可以通过自己编写简单的逻辑来实现.
转换为分钟,如果大于60,则将分钟除以60,四舍五入并将其显示为小时.
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.