asp.net 中日期和时间的格式化
这也许是一个小问题 但是有很多学问 不能眼高手低 我把大部分情况列出来 给大家一个提醒
float str = 987654.32F;
//Response.Write(string.Format("{0:c}", str));
//this.Label1.Text = string.Format("{0:D}", str);
//this.Label1.Text = string.Format("{0:C}", str);
Response.Write("<h1>日期格式化</h1>");
Response.Write("<br/>");
Response.Write("当前数字"+str);
Response.Write("<br/>");
Response.Write(string.Format("货币格式 {0:c}", str));
Response.Write("<br/>");
Response.Write(string.Format("科学技术法格式 {0:e}", str));
Response.Write("<br/>");
Response.Write(string.Format("科学计数法格式 12位有效数字{0:e12}", str));
Response.Write("<br/>");
Response.Write(string.Format("固定格式 {0:f}", str));
Response.Write("<br/>");
Response.Write(string.Format("固定格式 四位小数{0:f4}", str));
Response.Write("<br/>");
Response.Write(string.Format("常规格式 {0:g}", str));
Response.Write("<br/>");
Response.Write(string.Format("常规格式 六位有效数字{0:g6}", str));
Response.Write("<br/>");
Response.Write(string.Format("数字格式 {0:n}", str));
Response.Write("<br/>");
Response.Write(string.Format("数字格式 三位小数{0:n3}", str));
Response.Write("<br/>");
Response.Write(string.Format("十六进制{0:x}", 32));
Response.Write("<br/>");
Response.Write("<h1>日期格式化</h1>");
Response.Write("<br/>");
Response.Write("当前日期:" + System.DateTime.Now);
Response.Write("<br/>");
Response.Write(string.Format("短日期{0:d}", System.DateTime.Now));
Response.Write("<br/>");
Response.Write(string.Format("长日期{0:D}", System.DateTime.Now));
Response.Write("<br/>");
相关文档:
如何学习ASP.NET
2009-07-24 09:49
如果你已经有较多的面向对象开发经验,跳过以下这两步:
第一步 掌握一门.NET面向对象语言,C#或VB.NET。
我强烈反对在没系统学过一门面向对象语言的前提下去学ASP.NET。
ASP.NET是一个全面向对象的技术,不懂面向对象,那绝对学不下去!
第二步 对.NET Framework类库有一定的 ......
首先,在pageload里写入以下代码:Response.Write("<script>window.opener=null;window.close();</script>");
其次,在head里写下如下JS代码: <script language="JavaScript">
<!--
function openwin() { window.open ("Default.aspx", "newwindow", "height=600, width=600, toolbar=no, menubar=n ......
protected void Unite(GridView gv)
{
int i;
string LastType1;
int LastCell;
if (gv.Rows.Count > ......
1.C#连接连接Access
程序代码:
------------------------------------------------------------------------------- using System.Data;
using System.Data.OleDb;
..
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:BegASPNETNorthwind.mdb";
Ol ......
此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElem ......