string.Format("{0:d}",System.DateTime.Now) 结果为:2009-3-20 (月份位置不是03)

string.Format("{0:D}",System.DateTime.Now) 结果为:2009年3月20日

string.Format("{0:f}",System.DateTime.Now) 结果为:2009年3月20日 15:37

string.Format("{0:F}",System.DateTime.Now) 结果为:2009年3月20日 15:37:52

string.Format("{0:g}",System.DateTime.Now) 结果为:2009-3-20 15:38

string.Format("{0:G}",System.DateTime.Now) 结果为:2009-3-20 15:39:27

string.Format("{0:m}",System.DateTime.Now) 结果为:3月20日

string.Format("{0:t}",System.DateTime.Now) 结果为:15:41

string.Format("{0:T}",System.DateTime.Now) 结果为:15:41:50

string.Format 格式化输出日期的更多相关文章

  1. 使用printf和String.format格式化输出

    格式化输出 在哪些情况下使用格式化输出: 异常打印到日志中使用格式化输出有利于排查错误原因: printf格式化 示例: public class PrintfTest { public static ...

  2. string.Format格式化输出

    staticstring Format (string format,object arg0):将指定字符串中的一个或多个格式项替换为指定对象的字符串表示形式 (1)格式化货币(跟系统的环境有关,中文 ...

  3. Java String 函数常用操作 & format() 格式化输出,代码详解

    package _String_; import java.util.*; import java.math.*; import java.lang.*; public class _Strings ...

  4. c#基础学习(0703)之string.Format格式化日期

    C# string.Format格式化日期 DateTime dt = ,,,,,,); string.Format("{0:y yy yyy yyyy}",dt); //17 1 ...

  5. c# 字符串连接使用“+”和string.format格式化两种方式

    参考文章:http://www.liangshunet.com/ca/201303/218815742.htm 字符串之间的连接常用的两种是:“+”连接.string.format格式化连接.Stri ...

  6. String.Format 格式化货币的小问题

    今天在开发过程中,遇到一件让我觉得比较纳闷的事情:用String.Format 格式化充值金额的时候,我这样处理: String.Format("{0:C2}", dr[" ...

  7. java笔记--String类格式化当天日期转换符文档

    String类格式化当天日期 --如果朋友您想转载本文章请注明转载地址"http://www.cnblogs.com/XHJT/p/3877389.html "谢谢-- 转换符:% ...

  8. String.format()格式化日期(2)

    在以前的开发中,日期格式化一直使用的是SimpleDateFormat进行格式化.今天发现String.format也可以格式化.当 然,两种方式的优劣没有进行深入分析. 1. 日期格式化 (2018 ...

  9. string.Format 格式化日期格式

    DateTime dt = DateTime.Now;//2010年10月4日 17点05分            string str = "";            //st ...

随机推荐

  1. sublime text3 快捷键设置

    //插入到key binding user 里面,浏览器安装路径修改成自己的路径 1[ //firefox测试快捷键 { "keys":["f3"], &quo ...

  2. 关于listview排序的说明

    增加了排序属性后(即设置ListViewItemSorter属性),即便是把listview的内容全部清掉(listView.Items.Clear()),然后再重新添加行(listView.Item ...

  3. C++ Primer : 第十三章 : 拷贝控制之对象移动

    右值引用 所谓的右值引用就是必须将引用绑定到右值的引用,我们通过&&来绑定到右值而不是&, 右值引用只能绑定到即将销毁的对象.右值引用也是引用,因此右值引用也只不过是对象的别名 ...

  4. CSS3圆角

    使用border-radius属性: (1): (2)但是,如果你要在四个角上一一指定,可以使用以下规则: 四个值: 第一个值为左上角,第二个值为右上角,第三个值为右下角,第四个值为左下角. 三个值: ...

  5. 序列化SerialVersionUID

    Java中的SerialVersionUID - Java译站http://it.deepinmind.com/java/2014/05/25/why-use-serialversionuid-ins ...

  6. Faster-RCNN 训练自己的数据

    在前一篇随笔中,数据制作成了VOC2007格式,可以用于Faster-RCNN的训练. 1.针对数据的修改 修改datasets\VOCdevkit2007\VOCcode\VOCinit.m,我只做 ...

  7. Android学习五:Content Provider 使用

    1ContentProvider相关知识1.1在安卓应用中,通过文件方式对外共享数据,需要进行文件操作读写数据:采用sharedpreferences共享数据,需要使用sharedpreference ...

  8. arcgis server 10.2安装后,忘记Manager的用户名和密码

    arcgis server 10.2安装完毕后,需要创建站点,创建站点时,填写管理站点的用户名和密码.自己不小心,创建完毕后,给忘记了用户名和密码.求助Esri,解决方法如下: (1)找到arcgis ...

  9. node版本管理器nvm(服务器项目相关)

    git项目 https://github.com/creationix/nvm 1.下载并安装NVM脚本 curl https://raw.githubusercontent.com/creation ...

  10. winform里dataGridView分页代码,access数据库

    winform里dataGridView分页,默认dataGridView是不分页的和webform里不一样,webform中GridView自带自带了分页. 现在c/s的程序很多时候也需要webfo ...