ASP.net c# ÈÕÆÚת»¯[ת]
ÈÕÆÚת»¯Ò»
ΪÁË´ïµ½²»Í¬µÄÏÔʾЧ¹ûÓÐʱ£¬ÎÒÃÇÐèÒª¶Ôʱ¼ä½øÐÐת»¯£¬Ä¬ÈϸñʽΪ£º2007-01-03 14:33:34 £¬Òª×ª»¯ÎªÆäËû¸ñʽ£¬ÒªÓõ½DateTime.ToStringµÄ·½·¨(String, IFormatProvider)£¬ÈçÏÂËùʾ£º
using System;
using System.Globalization;
String format="D";
DateTime date=DataTime,Now;
Response.Write(date.ToString(format, DateTimeFormatInfo.InvariantInfo));
½á¹ûÊä³ö
Thursday, June 16, 2005
²ÎÊýformat¸ñʽÏêϸÓ÷¨£º
¸ñʽ×Ö·û ¹ØÁªÊôÐÔ/˵Ã÷
d ShortDatePattern
D LongDatePattern
f ÍêÕûÈÕÆÚºÍʱ¼ä£¨³¤ÈÕÆںͶÌʱ¼ä£©
F FullDateTimePattern£¨³¤ÈÕÆںͳ¤Ê±¼ä£©
g ³£¹æ£¨¶ÌÈÕÆںͶÌʱ¼ä£©
G ³£¹æ£¨¶ÌÈÕÆںͳ¤Ê±¼ä£©
m¡¢M MonthDayPattern
r¡¢R RFC1123Pattern
s ʹÓõ±µØʱ¼äµÄ SortableDateTimePattern£¨»ùÓÚ ISO 8601£©
t ShortTimePattern
T LongTimePattern
u UniversalSortableDateTimePattern ÓÃÓÚÏÔʾͨÓÃʱ¼äµÄ¸ñʽ
U ʹÓÃͨÓÃʱ¼äµÄÍêÕûÈÕÆÚºÍʱ¼ä£¨³¤ÈÕÆںͳ¤Ê±¼ä£©
y¡¢Y YearMonthPattern
ϱíÁгöÁ˿ɱ»ºÏ²¢ÒÔ¹¹Ôì×Ô¶¨ÒåģʽµÄģʽ¡£ÕâЩģʽÊÇÇø·Ö´óСдµÄ£»ÀýÈ磬ʶ±ð“MM”£¬µ«²»Ê¶±ð“mm”¡£Èç¹û×Ô¶¨Òåģʽ°üº¬¿Õ°××Ö·û»òÓõ¥ÒýºÅÀ¨ÆðÀ´µÄ×Ö·û£¬ÔòÊä³ö×Ö·û´®Ò³Ò²½«°üº¬ÕâЩ×Ö·û¡£Î´¶¨ÒåΪ¸ñʽģʽµÄÒ»²¿·Ö»ò䶨ÒåΪ¸ñʽ×Ö·ûµÄ×Ö·û°´ÆäÔÒ帴ÖÆ¡£
¸ñʽģʽ ˵Ã÷
d ÔÂÖеÄijһÌ졣һλÊýµÄÈÕÆÚûÓÐÇ°µ¼Áã¡£
dd ÔÂÖеÄijһÌ졣һλÊýµÄÈÕÆÚÓÐÒ»¸öÇ°µ¼Áã¡£
ddd ÖÜÖÐijÌìµÄËõдÃû³Æ£¬ÔÚ AbbreviatedDayNames Öж¨Òå¡£
dddd ÖÜÖÐijÌìµÄÍêÕûÃû³Æ£¬ÔÚ DayNames Öж¨Òå¡£
M Ô·ÝÊý×Ö¡£Ò»Î»ÊýµÄÔ·ÝûÓÐÇ°µ¼Áã¡£
MM Ô·ÝÊý×Ö¡£Ò»Î»ÊýµÄÔ·ÝÓÐÒ»¸öÇ°µ¼Áã¡£
MMM Ô·ݵÄËõдÃû³Æ£¬ÔÚ AbbreviatedMonthNames Öж¨Òå¡£
MMMM Ô·ݵÄÍêÕûÃû³Æ£¬ÔÚ MonthNames Öж¨Òå¡£
y ²»°üº¬¼ÍÔªµÄÄê·Ý¡£Èç¹û²»°üº¬¼ÍÔªµÄÄê·ÝСÓÚ 10£¬ÔòÏÔʾ²»¾ßÓÐÇ°µ¼ÁãµÄÄê·Ý¡£
yy ²»°üº¬¼ÍÔªµÄÄê·Ý¡£Èç¹û²»°üº¬¼ÍÔªµÄÄê·ÝСÓÚ 10£¬ÔòÏÔʾ¾ßÓÐÇ°µ¼ÁãµÄÄê·Ý¡£
yyyy °üÀ¨¼ÍÔªµÄËÄλÊýµÄÄê·Ý¡£
gg ʱÆÚ»ò¼ÍÔª¡£Èç¹ûÒªÉèÖøñʽµÄÈÕÆÚ²»¾ßÓйØÁªµÄʱÆÚ»ò¼ÍÔª×Ö·û´®£¬ÔòºöÂÔ¸Ãģʽ¡£
h 12 СʱÖƵÄСʱ¡£Ò»Î»ÊýµÄСʱÊýûÓÐÇ°µ¼Áã¡£
hh 12 СʱÖƵÄСʱ¡£Ò»Î»ÊýµÄСʱÊýÓÐÇ°µ¼Áã¡£
H 24 СʱÖƵÄСʱ¡£Ò»Î»ÊýµÄСʱÊýûÓÐÇ°µ¼Áã¡£
HH 24 СʱÖƵÄСʱ¡£Ò»Î»ÊýµÄСʱÊýÓÐ
Ïà¹ØÎĵµ£º
/*
±¾¶Î´úÂëÔÚ¹«Ë¾ÏîÄ¿ÖÐʵ¼ÊÔ¶³Ìµ÷ÓõÚÈý·½¹«Ë¾ÌṩµÄC#¿ª·¢WebServiceµÄʾÀý
*/
/**
* µÇ¼ÓÎÏ·
*
* @param paramPN
* @param paramTerraceID
* @param paramSvrID
*/
private String loginGame(String paramPN, HttpServletRequest req){
&n ......
×î½üÅöµ½Ò»ÎÊÌ⣬ÐèÒªÔÚASP.NetºÍJavaScriptÖд«µÝÊý¾Ý¡£¾ßÌåµÄÐèÇóÊÇÕâÑùµÄ£¬Ò³Ãæpostbackºó½«»áload JS£¬µ«ÊÇÐèÒª¼Çס֮ǰij¸ö״̬£¬Õâ¸ö״̬ÊÇÖ¸JSµÄ״̬£¬Ò²¾ÍÊÇ˵load JSºó£¬»¹Òª¼Çס֮ǰµÄ״̬£¬¶ø²»Êǻص½Ä¬ÈϵÄ״̬¡£
Ò»¿ªÊ¼ÏëÁ˺ܶà°ì·¨£¬µ«¶¼²»³É¹¦£¬ºóÀ´ÎÊÁËÎÊͬÊ£¬·¢ÏÖ¿ÉÒÔͨ¹ýÒþ²ØµÄ±íµ¥ÔªËØÀ´´«µÝÊý¾Ý£¬ËùÒ ......
public class PageBase:System.Web.UI.Page
{
public PageBase()
{
//
// TODO: Add constructor logic here
//
}
protected override void InitializeCulture()
{
// ......
http://www.chinaz.com/Program/.NET/101U1142006.html
¡¡¡¡1. ´ò¿ªÐµĴ°¿Ú²¢´«ËͲÎÊý£º
´«ËͲÎÊý£º
response.write("<script>window.open('*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"')</script>")
½ÓÊÕ²ÎÊý£º
string a = Request.QueryString("id");
string b = Request.QuerySt ......
ASP.NET ÅäÖýڼܹ¹°üº¬¿ØÖÆ ASP.NET Web Ó¦ÓóÌÐòÐÐΪµÄÔªËØ¡£Èç¹ûΪÊôÐÔÖ¸¶¨ÁËĬÈÏÖµ£¬Ôò¸ÃĬÈÏÖµÊÇÔÚ Machine.config ÎļþÖÐÉèÖõģ¬¸ÃÎļþµÄ·¾¶ÊÇ systemroot\Microsoft.NET\Framework\versionNumber\CONFIG\Machine.config¡£
<configuration>
<location>
......