我们可以将整数值1063转换为天,月,年 [英] Can we convert integer value 1063 into days, month, year

查看:161
本文介绍了我们可以将整数值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.


这篇关于我们可以将整数值1063转换为天,月,年的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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