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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Blocked AccountRank #403 · 6.2K reputationPosted Jun 21, 2012, 2:06 AM EDT
you can do this by using this
DateTime.Now.TimeOfDay
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 21, 2012, 6:02 AM EDT
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
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 21, 2012, 6:08 AM EDT
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm3.aspx.cs" Inherits="WebApplication17.WebForm3" %>
Suthish NairRank #92 · 22.8K reputationPosted Jun 21, 2012, 9:43 AM EDT