以文本方式查看主题 - 中文XML论坛 - 专业的XML技术讨论区 (http://bbs.xml.org.cn/index.asp) -- 『 Dot NET,C#,ASP,VB 』 (http://bbs.xml.org.cn/list.asp?boardid=43) ---- ★【汇总c#.net常用函数和方法集】★ (http://bbs.xml.org.cn/dispbbs.asp?boardid=43&rootid=&id=84657) |
-- 作者:卷积内核 -- 发布时间:5/8/2010 8:30:00 AM -- ★【汇总c#.net常用函数和方法集】★ ●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 取中文日期显示——年月日时分 1.10 取中文日期显示_年月 1.11 取中文日期显示_月日 1.12 取中文年月日 1.13 取当前时分,格式为:14:24 1.14 取当前时间,格式为:2003-09-23T14:46:48 1.15 取当前时间,格式为:2003-09-23 14:48:30Z 1.16 取当前时间,格式为:2003-09-23 14:48 1.17 取当前时间,格式为:Tue, 23 Sep 2003 14:52:40 GMT 1.18获得当前时间 n 天后的日期时间 ●2、Int32.Parse(变量) Int32.Parse("常量") ●3、 变量.ToString() ●5、System.Text.Encoding.Default.GetBytes(变量) ●6、System.Text.StringBuilder("") ●7、变量.Substring(参数1,参数2); ●8、String user_IP=Request.ServerVariables["REMOTE_ADDR"].ToString(); ●9、穿过代理服务器取远程用户真实IP地址: ●10、 Session["变量"]; 取值: Object objName=Session["username"]; ●11、String str=Request.QueryString["变量"]; ●12、DOC对象.CreateElement("新建节点名"); ●13、父节点.AppendChild(子节点); ●14、 父节点.RemoveChild(节点); ●15、Response Response.Redirect("URL地址"); |
W 3 C h i n a ( since 2003 ) 旗 下 站 点 苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》 |
187.500ms |