asp.net DateTime 时间函数
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;
(变量可用中文)
2.
dateObj = new Date();
dateObj.getYear();
dateObj.getMonth();
dateObj.getDate();
dateObj.getHour();
dateObj.getMinutes();
dateObj.getSeconds();
dateObj.getMilliseconds();
3.
DateTime now = new DateTime();
now = System.DateTime.Now;
String dateStr = now.ToString("yyyy年MM月dd日 HH:mm:ss");
出来的格式是如“2005年09月01日 12:00:00”
4.ToFileTimeUtc().ToString();//127756704859912816
Label4.Text = dt.ToLocalTime().ToString();//2005-11-5 21:21:25
Labe
相关文档:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
'若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消对下行的注释。
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(Confor ......
asp.net字符串截取实现代码,需要的朋友可以参考下。
1,把代码放在sqlhelper中。
复制代码 代码如下:
#region 截取字符串
/// <summary>
/// 截取字符串
/// </summary>
/// <param name="str_value"></param>
/// <param name="str_len"></param>
/// <returns&g ......
刚刚接触网页开发,不过遇到URR参数传递错误的问题,两个页面进行信息交互时可以用url进行传递,但是如果传递信息的编码格式不是UTF-8(或者不是设置的默认格式)URL传递时会出现乱码。
比如你传入汉字,或者传入"§”等其他编码格式的字符串系统解析后的url为乱码。经过在网上的查找觉得一下两种方式比较好:
1 ......
在上一篇博文《asp.net中的身份验证(最简单篇)》中的身份验证虽然很简单,但是有一个缺点,就是访问整个网站都必须要经过身份验证,而事实上,很多网站都不会这么要求的。
比如一个新闻系统,通常只有在发布新闻的网页才需要身份验证,而用户浏览新闻是不需要身份验证的。对于这种情况,就要针对不同的网页来进行身份验 ......
Asp.net中的日期处理函数
//2009年4月24日
this.TextBox6.Text = System.DateTime.Now.ToString("D");
//2009-4-24
this.TextBox7.Text = System.DateTime.Now.ToString("d");
//2009年4月24日 16:30:15
this.TextBox8.Text = System.DateTime.Now.ToString("F");
//2009年4月24日 16:30
this.TextBox9.Text ......