首页 >> 读书频道 >> 电脑 >> C#里操作时间的例子!
 
· C#消息队列应用程序 -
· 《.net编程先锋C#》
· 第四章 C#类型
· 《.net编程先锋C#》
· 《.net编程先锋C#》
· 用C#编写发手机中文短信
· 如何用Visual C#
· 用C#代码生成一个简单的
· 用C#和VB.NET实现
· 来自重粒子的C#程序
· C#操作技巧的数据类型之
· C#消息队列应用程序 -
 
· 加油金顺剧情分集介绍完整
· 红楼梦:120回全本[清
· 素质教育在美国
· 全唐诗卷四十六
· 韩剧《布拉格恋人》剧情介
· 夜航船[作者:明·张岱]
· 局外人[作者:韩·可爱淘
· 现场流行病学
· 源氏物语[日本:紫式部]
· 武林寓言故事
· 2006高考录取规则
· 首批中国世界名牌产品和2
 
· (出租)中动商场部分及写
· (出租)中动动漫基地&#
· 喜剧学院
· 《善德女王》剧情介绍
· 魔女18号 剧情
· 丑女无敌剧情介绍
· 魔女幼熙剧情介绍
· 龙游天下剧情介绍
· 震撼世界的七日剧情介绍
· 静静的白桦林剧情介绍
· 心情日记—老公今天我想对
· 旗舰剧情介绍
欢迎来到月影社区!如果您觉得这里不错,请推荐给您的朋友们。月影社区:http://wf66.com/

C#里操作时间的例子!


查看有无更新版本

关键字:MSSQL 2006-8-31

 

namespace Wrox.SampleCode.CSharpPreview.ChBaseClasses
{
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.WinForms;
using System.Data;
public class FormDisplayDateTimes : System.WinForms.Form
{
... as before
/// <summary>
/// Summary description for FormDisplayDateTimes.
/// </summary> public FormDisplayDateTimes()
{
//
// Required for Win Form Designer support
//

InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
// DateTime dtCurrTime = DateTime.Now;
AddItem("Current Time is " + dtCurrTime.ToString());
AddItem("Year is " + dtCurrTime.Year.ToString());
AddItem("Month is " + dtCurrTime.Month.ToString());
AddItem("Day of month is " + dtCurrTime.Day.ToString());
AddItem("Day of week is " + dtCurrTime.DayOfWeek.ToString());
AddItem("Hour is " + dtCurrTime.Hour.ToString());
AddItem("Minute is " + dtCurrTime.Minute.ToString());
AddItem("Second is " + dtCurrTime.Second.ToString());
AddItem("Millisecond is " + dtCurrTime.Millisecond.ToString());
AddItem("ShortDateString is " + dtCurrTime.ToShortDateString());
AddItem("LongDateString is " + dtCurrTime.ToLongDateString());
AddItem("ShortTimeString is " + dtCurrTime.ToShortTimeString());
AddItem("LongTimeString is " + dtCurrTime.ToLongTimeString());
}
public class FormTimeSpans : System.WinForms.Form
{
... as before
public FormTimeSpans()
{
//
// Required for Win Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
// constructor: TimeSpan(days, hours, minutes, seconds)
TimeSpan Span = new TimeSpan(4,2,15,0);
// initialize date to 1 Jan 2000, 12 pm
// constructor: DateTime(year,month,day,hours,minutes,seconds,
// milliseconds)
DateTime dtOld = new DateTime(2000,1,1,12,0,0,0);
DateTime dtNew = dtOld + Span;
AddItem("Original date was " + dtOld.ToLongDateString() +
" " + dtOld.ToShortTimeString());
AddItem("Adding time span of " + Span.ToString());
AddItem("Result is " + dtNew.ToLongDateString() + " " +
dtNew.ToShortTimeString());
AddItem("");
AddItem("Time span broken down is:");
AddItem("Days: " + Span.Days.ToString());
AddItem("Hours: " + Span.Hours.ToString());
AddItem("Minutes: " + Span.Minutes.ToString());
AddItem("Seconds: " + Span.Seconds.ToString());
AddItem("Milliseconds: " + Span.Milliseconds.ToString());
AddItem("Ticks: " + Span.Ticks.ToString());
AddItem("");
AddItem("TicksPerSecond: " + TimeSpan.TicksPerSecond.ToString());
AddItem("TicksPerHour: " + TimeSpan.TicksPerHour.ToString());

C#里操作时间的例子!

[ 1 ]
C#里操作时间的例子! num

打印本页 关闭

关于我们版权声明本站导航友情连结作品演示 TOP↑