Some methods of use of DateTime

zhaozj2021-02-16  54

1, DateTime Digital

System.datetime CurrentTime = new system.datetime ();

1.1 Take the first day of the month

CurrentTime = system.datetime.now;

1.2 taken the previous year

INT year = currenttime.year;

1.3 take the previous month

Int month = currenttime.month;

1.4 Take the day

INT day = currenttime.day;

1.5 Take the current time

INT = currenttime.Hour;

1.6 take the front part

INT = CURRENTTIME.MINUTE;

1.7 take the second second

INT second = currenttime.second;

1.8 takes the current millisecond

INT millisecond = currenttime.millisecond;

(Variable can be available in Chinese)

1.9 Take Chinese Date Display - Annual Month Time

String string = currenttime.tostring ("f"); // does not show second

1.10 Take Chinese Date Show_ 年 月

String stringm = currenttime.tostring ("y");

1.11 Take Chinese Date Show_ 月日

String strmd = currenttime.tostring ("m");

1.12 take Chinese Year and Month

String strymd = currenttime.tostring ("d");

1.13 Take the current time, format is: 14: 24

String strat = currenttime.tostring ("t");

1.14 Take the current time, format is: 2003-09-23T14: 46: 48

String strat = currenttime.tostring ("s");

1.15 Take the current time, format is: 2003-09-23 14: 48: 30Z

String strat = currenttime.tostring ("u");

1.16 Take the current time, format is: 2003-09-23 14:48

String strat = currenttime.tostring ("g");

1.17 Take the current time, format: Tue, 23 Sep 2003 14:52:40 GMT

String strat = currenttime.tostring ("r");

1.18 Gets the date and time of the current time n

DateTime newday = datetime.now.adddays (100);

HREF = "http://www.cnblogs.com/ppluncle/services/pingback.aspx" Rel = "pingback">

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

New Post(0)