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 ...
随机推荐
- 小强的HTML5移动开发之路(47)——jquery mobile基本的页面框架
一.单容器页面结构 <!DOCTYPE html> <html> <head> <title>Jquery mobile 基本页面框架</titl ...
- net的微服务架构
net的微服务架构 眼下,做互联网应用,最火的架构是微服务,最热的研发管理就是DevOps, 没有之一.微服务.DevOps已经被大量应用,它们已经像传说中的那样,可以无所不能.特来电云平台,通过近两 ...
- 【codeforces 546D】Soldier and Number Game
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- 《erlang程序设计》学习笔记-第3章 分布式编程
http://blog.csdn.net/karl_max/article/details/3985382 1. erlang分布式编程的基本模型 (1) 分布式erlang:这种模型可以让我们在一个 ...
- 【19.27%】【codeforces 618D】Hamiltonian Spanning Tree
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- R 语言文件读写
1. working directory:工作目录 > getwd() > setwd("C:/data") # 设定当前工作目录 2. 读取格式化的 table &g ...
- gcc/g++ 的参数总结(二)
gcc 参数总结 如果是 c++,直接将 gcc 改为 g++ 即可. 1. gcc 编译流程 预处理,Pre-Processing:gcc -E test.c -o test.i //.i文件 编译 ...
- Spring boot+RabbitMQ环境
Spring boot+RabbitMQ环境 消息队列在目前分布式系统下具备非常重要的地位,如下的场景是比较适合消息队列的: 跨系统的调用,异步性质的调用最佳. 高并发问题,利用队列串行特点. 订阅模 ...
- Vue插件资料
UI组件element ★11612 - 饿了么出品的Vue2的web UI工具套件 Vux ★7503 - 基于Vue和WeUI的组件库 iview ★5801 - 基于 Vuejs 的开源 UI ...
- 如何控制WAP网站上输入框的默认键盘类型
百度上对这样的资料介绍很多,基本上都和这个页面是一个意思 http://www.w3school.com.cn/html5/att_input_type.asp : 语法 <input type ...