Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 25-May-19 2:43am
Comments
[no name] 25-May-19 8:16am    
If I ask you how can I convert 1063 in Kilograms and Grams, you can't answer this. Right?
But if I tell you the 1063 are Grams you can answer it.
So what is the measure for this integer 1063?

Suppose the 1063 are days, you may find the answer here: c# - convert number of days into years,months,days - Stack Overflow[^]
astrotechlab 25-May-19 8:46am    
Obviously, 1063 days but in an integer type, I want to find out Number of Yr, Month & Days
[no name] 25-May-19 8:53am    
Obviously... ah ok, yes of course it is very obviously *lol*
Richard Deeming 29-May-19 12:54pm    
Do you mean that you want to know the number of years, months, and days that add up to 1063 days?

To answer that, first you'll have to invent a time machine, go back to the 18th century, and convince everybody to abandon the Gregorian calendar, and adopt a calendar where every month has the same number of days, and there are no leap years. :)

Without a starting point, you don't know how many days there are in a month, or even in a year. You'll either need to pick a random starting point, or use an approximation.

That depends. If "1603" is a "Number of days since nnn" then it's simple;
VB
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:
VB
Dim theBase as DateTime = new DateTime(2010, 1, 1)
Dim [then] as theBase.AddYears(1063 / 1000).AddDays(1063 Mod 1000)
(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.
 
Share this answer
 
Quote:
Can we convert Integer value 1063 into Days,Month,Year

Yes it is possible, but you first need to know/tell what is 1063. The exact solution depend on your answer.
 
Share this answer
 
Comments
astrotechlab 25-May-19 8:55am    
Obviously, 1063 days but in an integer type, I want to find out Number of Yr, Month & Days
Patrice T 25-May-19 9:25am    
Then the missing information is the starting date.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900