zoukankan      html  css  js  c++  java
  • 功能强大的ToString()

    //2008年4月24日
    this.Tb6.Text = System.DateTime.Now.ToString("D");
    //2008-4-24
    this.Tb7.Text = System.DateTime.Now.ToString("d");

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

    //2008-4-24 16:30:15
    this.Tb10.Text = System.DateTime.Now.ToString("G");
    //2008-4-24 16:30
    this.Tb11.Text = System.DateTime.Now.ToString("g");

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

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

    //4月24日
    this.Tb16.Text = System.DateTime.Now.ToString("m");
    this.Tb16.Text = System.DateTime.Now.ToString("M");
    //Tue, 24 Apr 2008 16:30:15 GMT
    this.Tb17.Text = System.DateTime.Now.ToString("r");
    this.Tb17.Text = System.DateTime.Now.ToString("R");
    //2008年4月
    this.Tb19.Text = System.DateTime.Now.ToString("y");
    this.Tb19.Text = System.DateTime.Now.ToString("Y");
    //2008-04-24T15:52:19.1562500+08:00
    this.Tb20.Text = System.DateTime.Now.ToString("o");
    this.Tb20.Text = System.DateTime.Now.ToString("O");
    //2008-04-24T16:30:15
    this.Tb18.Text = System.DateTime.Now.ToString("s");
    //2008-04-24 15:52:19
    this.Tb21.Text = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff");
    //2008年04月24 15时56分48秒
    this.Tb22.Text = System.DateTime.Now.ToString("yyyy年MM月dd HH时mm分ss秒");


    //星期二, 四月 24 2008
    this.Tb1.Text = System.DateTime.Now.ToString("dddd, MMMM dd yyyy");
    //二, 四月 24 '07
    this.Tb2.Text = System.DateTime.Now.ToString("ddd, MMM d \"'\"yy");
    //星期二, 四月 24
    this.Tb3.Text = System.DateTime.Now.ToString("dddd, MMMM dd");
    //4-07
    this.Tb4.Text = System.DateTime.Now.ToString("M/yy");
    //24-04-07
    this.Tb5.Text = System.DateTime.Now.ToString("dd-MM-yy");
    //2008-06-11
    this.Tb5.Text = System.DateTime.Now.ToString("yyyy-MM-dd");


    字符型转换 转为字符串
    12345.ToString("n"); //生成 12,345.00
    12345.ToString("C"); //生成 ¥12,345.00
    12345.ToString("e"); //生成 1.234500e+004
    12345.ToString("f4"); //生成 12345.0000
    12345.ToString("x"); //生成 3039 (16进制)
    12345.ToString("p"); //生成 1,234,500

  • 相关阅读:
    局部地区类似淘宝设想
    eclipse中安装GWT插件
    MYSQL数据库设计和数据库设计实例(三)
    MYSQL数据库设计和数据库设计实例(二)
    微软万维天文望远镜(Microsoft World Wide Telescope)
    html学习列表
    java中多线程学习一二点
    win7 64位下完美安装64位oracle 11g
    eclipse运行时不能自动保存的解决方法
    MYSQL数据库设计和数据库设计实例(一)
  • 原文地址:https://www.cnblogs.com/Hdsome/p/1217401.html
Copyright © 2011-2022 走看看