源代码中的时间差异 [英] Time diffrerence in source code

查看:130
本文介绍了源代码中的时间差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想计算源代码中的时差.

这是我的代码:

I want to calculate time difference in source code.

Here is my code:

On

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



但它不起作用.

我已经做到了,但是我丢失了代码,现在我忘记了.
但是我想我可以这样做,但是这次它不起作用.

我想要这样的结果,例如几小时前或几天前.

请任何人帮我如何在源代码中做到这一点.

在此先感谢

我也尝试这样做:
<%#System.DateTime.Now.Subtract(Convert.ToDateTime(Eval("Submit_date")))%>

但不起作用,我可以在其中添加ToString



but its not working.

I already done this but i have lost my code and now i forget it.
But i think i could do like this but this time its not working.

I want this result like how many hours ago or how many days ago.

please any one help me how can i do this in source code.

Thanks in advance

I also try this:
<%#System.DateTime.Now.Subtract(Convert.ToDateTime(Eval("Submit_date")))%>

But not working, where i can add ToString

推荐答案

try

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

希望对您有所帮助.:)
try

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

Hope it will help.. :)


此链接将为您提供帮助:thumbsup:
http://stackoverflow.com/questions/11/how-do-i-calculate-相对时间 [ ^ ]
This link will help you :thumbsup:
http://stackoverflow.com/questions/11/how-do-i-calculate-relative-time[^]


这篇关于源代码中的时间差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆