I don't have any new discoveries. It's just because I am a software developer and I don't have a lot of basic knowledge. I hope I can help you with it:
1. datetime comparison:
For example, datetime dt1 and dt2 can be compared directly using if (dt1> dt2). if it is converted to a string, it is unnecessary;
Of course, you can convert DateTime. Today. Date. ToOADate () to a decimal number for comparison;
If the time is saved as a string and it is not tightened, you can use DateTime dt = DateTime. parse ("2012/12/02"); to convert to the time format for comparison, it is not necessary to compare the year first, in the comparison month, in the comparison Day;
If you want to display the date in the desired format, you can use System. dateTime. today. date. toString ("yyMMdd");, where yyyy is a year (the last two digits can be expressed by yy), MM (must be capitalized) is a month, and dd is a day.
2. sometimes (especially when you need to generate a sequential number), you need to convert the number into two digits. Of course, you can write a function by yourself to determine the size, or the number of characters to implement:
For example, convert 1 to 01: string. Format ("{0: 00}", 1 );
Change 1 to 001: string. Format ("{0: 000}", 1 );
Change 001,002 to: string. Format ("{0: 000 );