Display current time in windows

In this blog we will know how to Display current time.

 

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace Display_current_time

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void btn_time_Click(object sender, EventArgs e)

        {

            DateTime dt = DateTime.Now;

            MessageBox.Show(dt.ToString("T"));

        }

    }

}

 

Ebook Download
View all
Learn
View all