DateTime具体是怎样用的,希望大虾们能够指点啊

解决方案 »

  1.   

    System.DateTime.Now--获取系统当前时间
      

  2.   

    System.DateTime.Parse(Convert.ToString(System.DateTime.Now)).ToString("yyyy-MM-dd");
    把时间转换为yyyy-MM-dd格式
      

  3.   

    http://singlepine.cnblogs.com/articles/255153.html
      

  4.   

    用 System.DataTime tim = System.DateTime.Now得到系统时间后,就可以对tim对象操作,察看一下帮助写的很详细的.
      

  5.   

    System.DateTime.Now 表示当前时间
      

  6.   

    下面是完整的代码,复制过去你可以用了,记的给分哈朋友
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;namespace gx
    {
    /// <summary>
    /// Form2 的摘要说明。
    /// </summary>
    public class Form2 : System.Windows.Forms.Form
    {
    private System.Windows.Forms.Label label1;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Form2()
    {
    //
    // Windows 窗体设计器支持所必需的
    //
    InitializeComponent(); //
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
    //
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.label1 = new System.Windows.Forms.Label();
    this.SuspendLayout();
    // 
    // label1
    // 
    this.label1.Location = new System.Drawing.Point(56, 72);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(160, 23);
    this.label1.TabIndex = 0;
    // 
    // Form2
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(292, 273);
    this.Controls.Add(this.label1);
    this.Name = "Form2";
    this.Text = "Form2";
    this.Load += new System.EventHandler(this.Form2_Load);
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form2());
    } private void Form2_Load(object sender, System.EventArgs e)
    {
    DateTime ShiJian = DateTime.Now;
    label1.Text = ShiJian.ToString(); }
    }
    }
      

  7.   

    http://community.csdn.net/Expert/topic/4460/4460764.xml?temp=.2808649