DateTime格式转换结果
Console.WriteLine(string.Format("ToLongDateString:{0}", DateTime.Now.ToLongDateString()));
Console.WriteLine(string.Format("ToLongTimeString:{0}", DateTime.Now.ToLongTimeString()));
Console.WriteLine(string.Format("ToOADate:{0}", DateTime.Now.ToOADate()));
Console.WriteLine(string.Format("ToShortDateString:{0}", DateTime.Now.ToShortDateString()));
Console.WriteLine(string.Format("ToShortTimeString:{0}", DateTime.Now.ToShortTimeString()));
Console.WriteLine(string.Format("ToString:{0}", DateTime.Now.ToString()));
Console.WriteLine(string.Format("ToString(\"yyyy - MM - dd HH:mm:ss.ffff\"):{0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffff")));
运行结果:
ToLongDateString:2017年9月21日
ToLongTimeString:16:02:30
ToOADate:42999.6684130671
ToShortDateString:2017/9/21
ToShortTimeString:16:02
ToString:2017/9/21 16:02:30
ToString("yyyy - MM - dd HH:mm:ss.ffff"):2017-09-21 16:02:30.8921
DateTime格式转换结果的更多相关文章
- C# DATETIME格式转换汇总 根据日期获取星期
原文:C# DATETIME格式转换汇总 根据日期获取星期 C# DateTime.Now.Year --2019(年) DateTime.Now.Month --9(月) DateTime.Now. ...
- DateTime格式转换部分介绍
DateTime与字符串转换: DateTime()与转换为字符串主要依靠DateTime().ToString(string format) 函数,以我的理解,参数format大体分为单个字母和多个 ...
- C# DATETIME格式转换汇总 根据日期过期星期
C# DateTime.Now.Year --2019(年) DateTime.Now.Month --9(月) DateTime.Now.Day --19(日) DateTime.Now.Hou ...
- C#DateTime格式转换全介绍
DateTime与字符串转换: DateTime()与转换为字符串主要依靠DateTime().ToString(string format) 函数,以我的理解,参数format大体分为单个字母和多个 ...
- Nullable<DateTime> DateTime? 格式转换问题 tostring()
解决方案: DateTime? dt2 = DateTime.Now; dt2.GetValueOrDefault().ToString("yyyy-MM-dd"); 控制器代码: ...
- sql server Datetime格式转换
select CONVERT(varchar, getdate(), 120 ) 2004-09-12 11:06:08 select replace(replace(replace(CONVERT( ...
- dateTime格式转换
select Convert(varchar(8),GETDATE(),112) Select replace(CONVERT(varchar(8), GETDATE(), 108),':','')
- string转DateTime(时间格式转换)
1.不知道为什么时间在数据库用varchar(8)来保存,例如"19900505",但是这样的保存格式在处理时间的时候是非常不方便的. 但是转换不能用Convert.ToDateT ...
- Nullable<System.DateTime>日期格式转换 (转载)
一.问题 1.html页面中时间显示出错,数据库中时间是正确的. 原因:没有把DateTime转成String类型. 2. 在C#中,发现不能直接使用ToString("yyyy-MM-d ...
随机推荐
- 使用DOT语言和Graphviz绘图(翻译)
Casa Taloyum About Me Blog Archives 使用DOT语言和Graphviz绘图(翻译) Date Wed 26 November 2014 Tags graphviz / ...
- SpringMVC拦截器-路径语法-略坑
项目中遇到一种场景,登录拦截器需要拦截.html后缀等动态请求,但是发现语法不对头. <mvc:interceptors> <mvc:interceptor> ...
- shell判断和比较
http://blog.chinaunix.net/uid-7553302-id-183648.html 1 shell 的$! ,$?, $$,$@ $n $1 the first ...
- TensorFlow 学习(十二)—— 高级函数
tf.map_fn(fn, elems):接受一个函数对象,然后用该函数对象对集合(elems)中的每一个元素分别处理, def preprocessing_image(image, training ...
- ssh远程无法连接VM中的Ubuntu问题
Ubuntu ssh远程无法连接问题 1. 检查sudo ps -e|grep ssh 查看是否有ssh进程服务,如果没有的话,需要下载安装 sudo apt-get install openss ...
- HTML_ul无序列表
本文来源于:http://blog.csdn.net/svitter 嵌套无序列表应用 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Tra ...
- 6LoWPAN - Transmission of IPv6 Packets over IEEE 802.15.4 Networks
6LoWPAN covered topics include the following: Frame format for transmission of IPv6 packets Method ...
- HTTP协议中的报文格式
按照传输过程,HTTP 报文分为请求报文和响应报文.请求报文和响应报文的结构差不多,这里只对 HTTP 请求报文做一个总结.HTTP 请求报文由 请求行.请求头.请求体(请求数据).空行 四个部分组成 ...
- 【37.68%】【hdu 5918】Sequence I
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s) ...
- Topshelf组件
使用Topshelf组件构建简单的Windows服务 很多时候都在讨论是否需要了解一个组件或者一个语言的底层原理这个问题,其实我个人觉得,对于这个问题,每个人都有自己的看法,个人情况不同,选择的方 ...