1. datetime numeric type
System. datetime currenttime = new system. datetime ();
1.1 take the current year, month, day, hour, minute, second
Currenttime = system. datetime. now;
1.2 get current year
Int year = currenttime. Year;
1.3 take the current month
Int month = currenttime. month;
1.4 get the current day
Int day = currenttime. Day;
1.5 current time
Int = currenttime. hour;
1.6 get the current score
Int = currenttime. minute;
1.7 takes the current second
Int second = currenttime. Second;
1.8 takes the current millisecond
Int millisecond = currenttime. millisecond;
(The variable can be in Chinese)
1.9 display Chinese date -- year, month, and day
String stry = currenttime. tostring ("F"); // seconds not displayed
1.10 use Chinese date to display _ year and month
String strym = currenttime. tostring ("Y ");
1.11 retrieve Chinese Date display _ month/day
String strmd = currenttime. tostring ("M ");
1.12 Chinese year, month, and day
String strymd = currenttime. tostring ("D ");
1.13 get the current time, format: 14: 24
String strt = currenttime. tostring ("T ");
1.14 obtain the current time in the format of 2003-09-23t14: 46: 48
String strt = currenttime. tostring ("S ");
1.15 obtain the current time in the format of 2003-09-23 14: 48: 30z
String strt = currenttime. tostring ("U ");
1.16 The current time. format:
String strt = currenttime. tostring ("G ");
1.17 take the current time, format: Tue, 23 Sep 2003 14:52:40 GMT
String strt = currenttime. tostring ("R ");
1.18 obtain the date and time of the current time n days later
Datetime newday = datetime. Now. adddays (100 );