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/>");
相关文档:
1、在线用户列表的实现
在ASP时代,要实现一个网站的在线用户列表显示功能的惯用做法是修改global.asa文件中的:Application_Start、Session_Start和Session_End这三个函数。在ASP.NET时代,我依然这样做。但是必须注意很多问题。首先来看看最简单的代码实现:
protected void Application_Start(Object sender, EventArg ......
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications. This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have th ......
[转]asp.net 母版页使用详解
母版页(扩展名是.master)
它的使用跟普通的页面一样,可以可视化的设计,也可以编写后置代码。与普通页面不一样的是,它可以包含ContentPlaceHolder控件,ContentPlaceHolder控件就是可以显示内容页面的区域。
代码如下:
<%@ Master Language="C#" AutoEventWireup="true" CodeFile=" ......
<script type="text/javascript">
var xmlHttp;
function createXMLHttpRequest()
{
......