1
using System;
2
using System.Collections.Generic;
3
using System.Text;
4
5
namespace xiao
6
{
7
/// <summary>
8
/// Create by 黄林峰
9
/// </summary>
10
class Program
11
{
12
static void Main(string[] args)
13
{
14
try
15
{
16
DateTime d;
17
DateTime dNow;
18
dNow = System.DateTime.Now;
19
string strDateTime = dNow.ToString("yyyyMMddHHmmss");
20
Console.WriteLine("当前时间(正常显示):" + dNow.ToString("yyyy年MM月dd日HH时mm分ss秒"));
21
Console.WriteLine("当前时间:"+strDateTime);
22
d = DateTime.ParseExact(strDateTime, "yyyyMMddhhmmss", System.Globalization.CultureInfo.CurrentCulture);
23
Console.WriteLine("转换时间(正常显示):"+d.ToString("yyyy年MM月dd日HH时mm分ss秒"));
24
Console.WriteLine("转换时间:" + d.ToString("yyyyMMddHHmmss"));
25
}
26
catch (Exception exp)
27
{
28
System.Console.WriteLine(exp.Message);
29
}
30
}
31
}
32
}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32
