1.DateTime (date)
Defined:
(1). DateTime Variable name = new DateTime (year, month, day, time, minute, second);(year, month, day, time, minute, second type must be int)
(2). DateTime variable name = DateTime. Attribute;
The most commonly used properties are:
Now gets the local time. (most commonly used)
Year gets the part of the middle age. (default value is 1)
Month gets the portion of the date in the months. (default value is 1)
Day gets the part of the date. (default value is 1)
Hour gets the part of the date. (default value is 1)
Minute gets the part of the date that is divided. (default value is 1)
Second gets the part of the date in seconds. (default value is 1)
The most common way:
DateTime dt = DateTime.Now;
int i = dt. year;
Console.WriteLine (i);
2.Random (random number)
Grammar:
Random rd = new random ();(define a single number)
int i;
(1). I= Rd. Next (); randomly generates a number.
(2). i = Rd. Next (100); randomly produces a number less than 100.
(3). I= Rd. Naxt (100,1000) randomly generates a number greater than 100 and less than 1000.
C#datetime and Random