本文介绍了使用标签的最新更新消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我需要在asp.net C#中更新消息
更新的消息应少于系统时间5分钟.
假设现在时间是上午10:55,最后更新的消息应该是我吗
像这样最后更新于10:50 am
Hi frnds,
i need update message in asp.net C#
Updated Message should be less than 5 minutes system time.
suppose now the time is 10:55 am and the last updated message should me
like this last updated at 10:50 am
protected void Timer2_Tick(object sender, EventArgs e)
Label1.Text = "Last Updated at : " + DateTime.Now.ToLongTimeString();
Thanks
推荐答案
DateTime.Now.AddMinutes(-5);
干杯
Cheers
protected void Timer2_Tick(object sender, EventArgs e)
{
Label1.Text = "Last Updated at : " + DateTime.Now.AddMinutes(-5).ToLongTimeString();
}
<asp:timer id="Timer1" ontick="Timer1_Tick" runat="server" interval="300000" xmlns:asp="#unknown" />
然后进行最后的更新,如
Then make the last update like
protected void Timer2_Tick(object sender, EventArgs e)
Label1.Text = "Last Updated at : " + DateTime.Now.AddMinutes(-5).ToLongTimeString();
要停止计时器:
To stop the timer:
protected void Timer2_Tick(object sender, EventArgs e)
Label1.Text = "Last Updated at : " + DateTime.Now.AddMinutes(-5).ToLongTimeString();
timer1.Enabled = false;
干杯
Cheers
这篇关于使用标签的最新更新消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!