将Double转换为DateTime [英] Converting a Double to DateTime

查看:125
本文介绍了将Double转换为DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,由于Convert.ToDateTime尚未实现,如何将

a转换为日期时间???


我看了所有完全没有运气。


请帮帮我!

Ok, As the Convert.ToDateTime has not been implimented yet, how do I convert
a double to datetime???

I have looked all over with no luck at all.

Please help me!

推荐答案

嗨奥利,

首先:你想如何将双倍转换为日期时间?

我听说过长整数(毫秒)日期/时间表示

但我没有听到任何双重日期/时间表示。


问候


Marcin
Hi Ollie,

First of all: How do you want to convert double to datetime?
I heard about long integer (millisecond) date/time representation
but i don''t hear of any double date/time representation.

Regards

Marcin
好的,由于Convert.ToDateTime还没有被激发,如何将
转换成双倍的日期时间?

我看了一遍都没有运气。

请帮帮我!
Ok, As the Convert.ToDateTime has not been implimented yet, how do I convert
a double to datetime???

I have looked all over with no luck at all.

Please help me!



嗨Ollie,


它完全取决于double中存储的信息以及存储方式。可以使用单个数字存储和创建DateTime(长)

DateTime dt = new DateTime(ticks);


其中ticks是从1月1日起100纳秒单位的数量.1000

-

快乐的编码!

Morten Wennevik [C#MVP ]
Hi Ollie,

It depends entirely on what information is stored in the double, and how it is stored. A DateTime can be stored and created using a single number (long)

DateTime dt = new DateTime(ticks);

where ticks is the number of 100-nanosecond units from January 1. 0001

--
Happy coding!
Morten Wennevik [C# MVP]


使用静态方法:


DateTime.FromOADate()

Arild


" Ollie" <醇********** @ hotmail.com>在消息中写道

新闻:uD ************** @ TK2MSFTNGP11.phx.gbl ...
Use the static method:

DateTime.FromOADate()
Arild

"Ollie" <ol**********@hotmail.com> wrote in message
news:uD**************@TK2MSFTNGP11.phx.gbl...
好的,作为转换.ToDateTime还没有被激发,我怎么把
转换成双倍的日期时间???

我看完了一遍都没有运气。

请帮帮我!
Ok, As the Convert.ToDateTime has not been implimented yet, how do I convert a double to datetime???

I have looked all over with no luck at all.

Please help me!



这篇关于将Double转换为DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆