1、datetime 數字型
system.datetime currenttime=new system.datetime();
1.1 取當前年月日時分秒
currenttime=system.datetime.now;
1.2 取當前年
int 年=currenttime.year;
1.3 取當前月
int 月=currenttime.month;
1.4 取當前日
int 日=currenttime.day;
1.5 取當前時
int 時=currenttime.hour;
1.6 取當前分
int 分=currenttime.minute;
1.7 取當前秒
int 秒=currenttime.second;
1.8 取當前毫秒
int 毫秒=currenttime.millisecond;
(變數可用中文)
1.9 取中文日期顯示——年月日時分
string stry=currenttime.tostring("f"); //不顯示秒
1.10 取中文日期顯示_年月
string strym=currenttime.tostring("y");
1.11 取中文日期顯示_月日
string strmd=currenttime.tostring("m");
1.12 取中文年月日
string strymd=currenttime.tostring("d");
1.13 取當前時分,格式為:14:24
string strt=currenttime.tostring("t");
1.14 取當前時間,格式為:
常用c 函式
字串是不是數字 static int isnumber const char z,int realnum z if realnum realnum 0 找到第一個不是數字的位置 while isdigit z if z if realnum realnum 1 if z e z e if realn...
c 常用函式
1 datetime 數字型 system.datetime currenttime new system.datetime 1.1 取當前年月日時分秒 currenttime system.datetime.now 1.2 取當前年 int 年 currenttime.year 1.3 取當前月 ...
C 常用函式
1 datetime 數字型 system.datetime currenttime new system.datetime 1.1 取當前年月日時分秒 currenttime system.datetime.now 1.2 取當前年 int 年 currenttime.year 1.3 取當前月 ...
c 常用函式
c 中常用的一些函式,記錄下來以防忘記!首先,字串string類 輸入 include string str getline cin,str int len str.length int ipos str.find a 6 從str的第六個位置處開始查詢 a int ipos str.rfind a...
c 常用函式
1 datetime 數字型 system.datetime currenttime new system.datetime 1.1 取當前年月日時分秒 currenttime system.datetime.now 1.2 取當前年 int 年 currenttime.year 1.3 取當前月 ...