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 顺序结构时间日期
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "今天的日期是:" + DateTime.Now.ToLongDateString();
}
        private void 查询时间_Click(object sender, EventArgs e)
        {
            this.textBox1.Text = "现在是北京时刻:" + DateTime.Now.Hour.ToString() + "点" + DateTime.Now.Minute.ToString() + "分" + DateTime.Now.Second.ToString() + "秒";
        }
    }
}

原文:http://www.cnblogs.com/zxtbk96/p/6896494.html