码迷,mamicode.com
首页 > Windows程序 > 详细

C#控制台基础 提取出中x年x月x日的年数,月数,日数

时间:2016-10-07 18:09:02      阅读:293      评论:0      收藏:0      [点我收藏+]

标签:

1、代码

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Linq;
 4 using System.Text;
 5 using System.Threading.Tasks;
 6 
 7 namespace ConsoleApplication2
 8 {
 9     class Program
10     {
11         static void Main(string[] args)
12         {
13             string nowTime = "2016年10月07日";
14             string[] time = nowTime.Split(new char[] { , ,  }, StringSplitOptions.RemoveEmptyEntries);
15             string year = time[0];
16             string month = time[1];
17             string day = time[2];
18 
19             foreach (var item in time)
20             {
21                 Console.WriteLine(item);
22             }
23             {
24 
25             }
26 
27             Console.ReadKey();
28         }
29 
30     }
31 
32 }

 

 

2、效果

技术分享

C#控制台基础 提取出中x年x月x日的年数,月数,日数

标签:

原文地址:http://www.cnblogs.com/jinlingzi/p/5936167.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!