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)
2. Int32.Parse (variable) Int32.Parse ("constant ")
Convert string to 32-digit font
3. Variable. ToString ()
Convert string to string
12345. ToString ("n"); // Generate 12,345.00
12345. ToString ("C"); // Generate $12,345.00
12345. ToString ("e"); // Generate 1.234500e + 004
12345. ToString ("f4"); // Generate 12345.0000
12345. ToString ("x"); // Generate 3039 (hexadecimal)
12345. ToString ("p"); // Generate 1,234,500.00%
4. Variable. Length numeric type
String length:
For example, string str = "China ";
Int Len = str. Length; // Len is a custom variable, and str is the variable name of the string to be tested.
5. System. Text. Encoding. Default. GetBytes (variable)
Convert character code to bit code
For example, byte [] bytStr = System. Text. Encoding. Default. GetBytes (str );
Then we can get the bit length:
Len = bytStr. Length;
6. System. Text. StringBuilder ("")
String addition, (is the same as the + number ?)
For example, System. Text. StringBuilder sb = new System. Text. StringBuilder ("");
Sb. Append ("China ");
Sb. Append ("people ");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service