博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C# TimeClass
阅读量:7090 次
发布时间:2019-06-28

本文共 886 字,大约阅读时间需要 2 分钟。

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mytime

{
public class time
{
private
int Year;
int Month;
int Day;
int Hour;
int Minute;
int Second;
public
void Show()
{
Console.WriteLine("{0} {1} {2} {3} {4} {5}",Year, Month, Day, Hour, Minute,Second);
}
public time(System.DateTime dt){
Year = dt.Year;
Month = dt.Month;
Day = dt.Day;
Hour = dt.Hour;
Minute = dt.Minute;
Second = dt.Second;
}
public time( int Year = 0 , int Month = 0, int Date = 0, int Hour = 0, int Minute = 0,int Second = 0) { this.Year = Year; this.Month = Month; this.Day = Date; this.Hour = Hour; this.Minute = Minute;
}
}

class Tester

{
static void Main()
{
System.DateTime cT = System.DateTime.Now;
time t = new time(cT);
t.Show();
time t2 = new time(1995,3,21,8);
t2.Show();
}
}
}

转载于:https://www.cnblogs.com/yi-jie/p/4361250.html

你可能感兴趣的文章
HTTP协议详解
查看>>
memcache 基础原理
查看>>
关于Oracle12c的安装心得
查看>>
六一儿童节将至,网上为孩子选购礼品谨防钓鱼欺诈
查看>>
Eclipse中配置Tomcat
查看>>
CodeForces 148D Bag of mice
查看>>
xx局点FusionCloud6.3type1修改配额占用
查看>>
2019-3-1号作业
查看>>
2019-3-8
查看>>
【Python3爬虫】百度一下,坑死你?
查看>>
用正则获取百度贴吧当日新贴
查看>>
解决SqlServer 2005 sa帐户不能登录问题
查看>>
Mac 下 yii2安装 redis扩展
查看>>
Javascript中将函数参数arguments转为数组
查看>>
那些年一起用过的iOS开发利器[4月2号更新]
查看>>
C# WinForm界面上实现按条件检索数据
查看>>
JS转换HTML转义符
查看>>
apiDoc 入门
查看>>
数据库面试技巧,通过JDBC展示自己专业性,摘自java web轻量级开发面试教程
查看>>
Ubuntu 16.10下的eclipse
查看>>