c# datetime转double
时间: 2023-09-04 11:13:49 浏览: 227
在C#中,可以使用DateTime的ToOADate方法将DateTime类型转换为double类型。例如,使用以下代码将DateTime转换为double:
DateTime dateTime = DateTime.Now;
double doubleValue = dateTime.ToOADate();
这将返回一个表示DateTime值的双精度浮点数。请注意,DateTime的最小值对应于OADate的0,而DateTime的最大值对应于OADate的2958465.99999999。
#### 引用[.reference_title]
- *1* [C# 中 double 型数值与 DateTime 的相互转换](https://blog.csdn.net/weixin_40626630/article/details/85276682)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [C#datetime日期格式转换](https://blog.csdn.net/ABC13222880223/article/details/120218138)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文