c 中常用到的時間函式

2021-09-05 19:33:28 字數 1138 閱讀 8855

datetime 數字型 system.datetime currenttime=new system.datetime();

1 取當前年月日時分秒 currenttime=system.datetime.now;

2 取當前年 int 年=currenttime.year;

3 取當前月 int 月=currenttime.month;

4 取當前日 int 日=currenttime.day;

5 取當前時 int 時=currenttime.hour;

6 取當前分 int 分=currenttime.minute;

7 取當前秒 int 秒=currenttime.second;

8 取當前毫秒 int 毫秒=currenttime.millisecond; (變數可用中文)

9 取中文日期顯示——年月日時分 string stry=currenttime.tostring("f"); //不顯示秒

10 取中文日期顯示_年月 string strym=currenttime.tostring("y");

11 取中文日期顯示_月日 string strmd=currenttime.tostring("m");

12 取中文年月日 string strymd=currenttime.tostring("d");

13 取當前時分,格式為:14:24 string strt=currenttime.tostring("t";)

14 取當前時間,格式為:2003-09-23t14:46:48 string strt=currenttime.tostring("s");

15 取當前時間,格式為:2003-09-23 14:48:30z string strt=currenttime.tostring("u");

16 取當前時間,格式為:2003-09-23 14:48 string strt=currenttime.tostring("g");

17 取當前時間,格式為:tue, 23 sep 2003 14:52:40 gmt string strt=currenttime.tostring("r");

18獲得當前時間 n 天後的日期時間 datetime newday = datetime.now.adddays(100);

mysql中常用到的時間函式,建議收藏

昨天 select date add curdate interval 1 day 本月1號 select date format now y m 01 本年1號 select date sub curdate interval dayofyear now 1 day 昨天 select date ...

python 中 常用到的 numpy 函式 整理

1.建立二維陣列 array set array 1.2,3.4.5.6.7.9.求 陣列的 行數 set.shape 0 4求 陣列的列數 set.shape 1 set.shape 4,2 set.dtype dtype float64 記得 from numpy import 2 empty ...

IOS開發中常用到的工具方法(時間方面)

獲取當前時間資訊 nsdatecomponents nscalendar calendar nscalendar alloc initwithcalendaridentifier nscalendaridentifiergregorian 公曆 nsdatecomponents comps nsda...