zoukankan      html  css  js  c++  java
  • .net 时间格式

       //2007年4月24日
         this.TextBox6.Text = System.DateTime.Now.ToString("D");
         //2007-4-24
         this.TextBox7.Text = System.DateTime.Now.ToString("d");

         //2007年4月24日 16:30:15
         this.TextBox8.Text = System.DateTime.Now.ToString("F");
         //2007年4月24日 16:30
         this.TextBox9.Text = System.DateTime.Now.ToString("f");

         //2007-4-24 16:30:15
         this.TextBox10.Text = System.DateTime.Now.ToString("G");
         //2007-4-24 16:30
         this.TextBox11.Text = System.DateTime.Now.ToString("g");

         //16:30:15
         this.TextBox12.Text = System.DateTime.Now.ToString("T");
         //16:30
         this.TextBox13.Text = System.DateTime.Now.ToString("t");

         //2007年4月24日 8:30:15
         this.TextBox14.Text = System.DateTime.Now.ToString("U");
         //2007-04-24 16:30:15Z
         this.TextBox15.Text = System.DateTime.Now.ToString("u");

         //4月24日
         this.TextBox16.Text = System.DateTime.Now.ToString("m");
         this.TextBox16.Text = System.DateTime.Now.ToString("M");
         //Tue, 24 Apr 2007 16:30:15 GMT
         this.TextBox17.Text = System.DateTime.Now.ToString("r");
         this.TextBox17.Text = System.DateTime.Now.ToString("R");
         //2007年4月
         this.TextBox19.Text = System.DateTime.Now.ToString("y");
         this.TextBox19.Text = System.DateTime.Now.ToString("Y");
         //2007-04-24T15:52:19.1562500+08:00
         this.TextBox20.Text = System.DateTime.Now.ToString("o");
         this.TextBox20.Text = System.DateTime.Now.ToString("O");
         //2007-04-24T16:30:15
         this.TextBox18.Text = System.DateTime.Now.ToString("s");
         //2007-04-24 15:52:19
         this.TextBox21.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
         //2007年04月24 15时56分48秒
         this.TextBox22.Text = System.DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒");


         //星期二, 四月 24 2007
         this.TextBox1.Text = System.DateTime.Now.ToString("dddd, MMMM dd yyyy");
         //二, 四月 24 '07
         this.TextBox2.Text = System.DateTime.Now.ToString("ddd, MMM d "'"yy");
         //星期二, 四月 24
         this.TextBox3.Text = System.DateTime.Now.ToString("dddd, MMMM dd");
         //4-07
         this.TextBox4.Text = System.DateTime.Now.ToString("M/yy");
         //24-04-07
         this.TextBox5.Text = System.DateTime.Now.ToString("dd-MM-yy");

    DateTime.Now的后面有若干个ToString(),ToShortTimeString()之类的东东,到底都是干啥用的,还是做个程序测试一下吧System.DateTime.Now.ToString()的一些用法

                string str = "";
                
                str += "ToShortDateString:" + DateTime.Now.ToShortDateString() + "<br>";
                str += "ToShortTimeString:" + DateTime.Now.ToShortTimeString() + "<br>";
                str += "ToLongDateString" + DateTime.Now.ToLongDateString() + "<br>";
                str += "ToLongTimeString" + DateTime.Now.ToLongTimeString() + "<br>";
                str += "ToString:" + DateTime.Now.ToString() + "<br>";

                Response.Write( str );
  • 相关阅读:
    PAT 1010. 一元多项式求导 (25)
    PAT 1009. 说反话 (20) JAVA
    PAT 1009. 说反话 (20)
    PAT 1007. 素数对猜想 (20)
    POJ 2752 Seek the Name, Seek the Fame KMP
    POJ 2406 Power Strings KMP
    ZOJ3811 Untrusted Patrol
    Codeforces Round #265 (Div. 2) 题解
    Topcoder SRM632 DIV2 解题报告
    Topcoder SRM631 DIV2 解题报告
  • 原文地址:https://www.cnblogs.com/NazLee/p/8724077.html
Copyright © 2011-2022 走看看