我们可以将整数值1063转换为天,月,年

我们可以将整数值1063转换为天,月,年

问题描述:

我们可以将整数值1063转换为天,月,年

如何在vb.net中完成



什么我试过了:



我们可以将整数值1063转换为天,月,年

Can we convert Integer value 1063 into Days,Month,Year
How to do in vb.net

What I have tried:

Can we convert Integer value 1063 into Days,Month,Year

这取决于。如果1603是自nnn以来的天数那么它很简单;

That depends. If "1603" is a "Number of days since nnn" then it's simple;
Dim theBase As DateTime = New DateTime(2001, 1, 1)
Dim [then] As DateTime = theBase.AddDays(1o63)

如果是年加一年然后你可以很容易地做到:

If it's a "year plus a day-of-year" then you can do it reasonably easily:

Dim theBase as DateTime = new DateTime(2010, 1, 1)
Dim [then] as theBase.AddYears(1063 / 1000).AddDays(1063 Mod 1000)

(但请注意,Day of year有两种不同的系统,在闰年产生不同的结果。)

如果不是,那么你需要准确指定它是什么,因为整数不是日期,并且不能直接转换为日期。

(But be aware that there are two different systems for "Day of year" which produce different results on leap years.)
If it isn't, then you need to specify exactly what it is, because an integer is not a date, and isn't directly convertible to a date.


Quote:

我们可以将整数值1063转换为天,月,年

Can we convert Integer value 1063 into Days,Month,Year



是的,这是可能的,但你首先需要知道/告诉1063是什么。确切的解决方案取决于你的答案。


Yes it is possible, but you first need to know/tell what is 1063. The exact solution depend on your answer.