View Full Version : Solved: Compute Months And Days From Decimal Value...
Wolfgang
03-16-2007, 11:24 AM
Dear All?
I have this decimal value: 1.711061088 meaning 1 year plus .711061088 of that year?
Now, is it possible to compute that value into months and days such as 1 year plus x-months plus x-days?
Thank you,
Wolfgang
Bob Phillips
03-16-2007, 01:46 PM
Wolfgang, the problem is starting from where. For instance, 30 days after 1st Jan is 30th Jan, 30 days past 1st Feb is 3rd Mar. This code will add it to the 1st Jan of this year, but assumes the year has 365 days
Dim nTime As Double
Dim dte As Date
nTime = 1.711061088
dte = DateSerial(Year(Date), 1, 1) + nTime * 365
MsgBox dte
Sorry about the linebreaks (lack of), VBAX is just not playing for me at the moment.
Norie
03-16-2007, 02:34 PM
Wolfgang
What year does 1 actually represent?
Wolfgang
03-17-2007, 12:25 AM
Hi Bob...
Thank you very much for your idea...I will give it a try...
Best,
Wolfgang
Wolfgang
03-17-2007, 12:27 AM
Hi Norie...
The 1 represents the current year...and the stuff which follows represent the remaining months and days...
Best,
Wolfgang
Wolfgang
03-18-2007, 08:36 AM
Hi Bob,
"Don't Let Me Be Misunderstood"...I wasn't too specific with my problem...
The number 1.711061088 actually represents a difference between two dates so, 1 designates One Year and the rest is the fraction of that year...
The result should be a breakdown of a year...
If I'm not totally mistaken .711061088 equals the end of August???!!!
Best,
Wolfgang
Bob Phillips
03-18-2007, 04:36 PM
It comes out as 16th Sep for me, which is whta displays.
Wolfgang
03-18-2007, 11:56 PM
Hi Bob...
That's what I meant by "End Of August"....
Thank you very much,
Wolfgang
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.