hi friends,
how i can i display current time in website ? example when i open my website the time should be run automatically. please explain about this in asp.net.
thanks
hi friends,
how i can i display current time in website ? example when i open my website the time should be run automatically. please explain about this in asp.net.
thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Suthish NairPosted Jun 21, 2012, 1:43 PM
Satyapriya NayakPosted Jun 21, 2012, 10:08 AM
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication17.WebForm3" %>
Satyapriya NayakPosted Jun 21, 2012, 10:02 AM
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication17.WebForm2" %>
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace WebApplication17
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Timer1_Tick(object sender, EventArgs e)
{
Label1.Text=DateTime.Now.ToString("hh:mm:ss");
}
}
}
Thanks
If this post helps you mark it as answer
Blocked AccountPosted Jun 21, 2012, 6:06 AM
you can do this by using this
DateTime.Now.TimeOfDay