Time handling

xiaoxiao2021-04-06  270

Current date time acquisition: DateTime DateTime1 = DateTime.Now; Date Time Operation: String Str1 = (DateTime1.addyEars (1)). TOSTRING (); // Add Year String Str1 = (DateTime1.addmont Hs (1)). TOSTRING (); // String string string string string string str1 = (1)). Tostring (); // Plus date string str1 = (DateTime1.addhouse (1)). Tostring (); // Emmure String string STR1 = (DateTime1.addminutes (1)). TOSTRING (); // Different String Str1 = (DateTime1.addSeconds (1)). TOSTRING (); // Add String Str1 = (DateTime1.addMilliseConds (1)). TOSTRING (); // plus milliseconds string str1 = (DateTime1.addyEars (-1)). Tostring (); // Decrease Year Long long1 = system.datetime.daysinmonth (2005, 2); // Return to a month A few days string str1 = datetime1.dayofweek.tostring ("d"); // Convert Week to digital characters Sunday is 0 timespan subtime = DATETIME1.SUBTRACT (datetime2); // Get the interval between DateTime1 and DateTime2, specific Time can be separated from Subtime. Separation of time: long long1 = datetime1.year; // Number Long long1 = DATETIME1.MONTH; // Get a month long long1 = DateTime1.day; // Get Date Long long1 = DateTime1.Hour; // Hourly LONG Long1 = DATETIME1.MINUTE; / / Take a score long long1 = datetime1.second; // get a second long long1 = datetime1.milliseCond; // get milliseconds

转载请注明原文地址:https://www.9cbs.com/read-132264.html

New Post(0)