如何获取当前系统时间 DateTime具体是怎样用的,希望大虾们能够指点啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 System.DateTime.Now--获取系统当前时间 System.DateTime.Parse(Convert.ToString(System.DateTime.Now)).ToString("yyyy-MM-dd");把时间转换为yyyy-MM-dd格式 http://singlepine.cnblogs.com/articles/255153.html 用 System.DataTime tim = System.DateTime.Now得到系统时间后,就可以对tim对象操作,察看一下帮助写的很详细的. System.DateTime.Now 表示当前时间 下面是完整的代码,复制过去你可以用了,记的给分哈朋友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(); } }} http://community.csdn.net/Expert/topic/4460/4460764.xml?temp=.2808649 困扰良久,百度贴吧造成webbrowser假死问题 读取串口问题!!!是否有人遇到过???? string 类型的赋值问题 数据添加成功,但是数据库数据没有更新是怎么回事?急!急! 用javascript传回来的值如何赋值给cs文件里定义的变量 C# 把数据添加至已经存在WORD文档的末尾 datagrid问题 问一个简单问题,winform下这个程序怎么使用? 你有好办法吗? 如果你有C/C++基础的进来看看 做SMTP客户端遇到的问题:535 Error: authentication failed 高分求 水晶报表 for .net的电子书籍 DES 解密问题,IV 如何设定
把时间转换为yyyy-MM-dd格式
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(); }
}
}