|
-
Aug 13th, 2002, 10:47 PM
#1
Thread Starter
Addicted Member
Convert a number into Date
Hello there,
Does anybody knows how can I convert this no. (254) into its equivalent Month and days. Its actually 254 days of the year 2001. I want to Know how can I know its August 10,2001. (08/10/2001). Automatically using codes.
Pls. help. its important.
-
Aug 13th, 2002, 10:49 PM
#2
Fanatic Member
use DateAdd function
VB Code:
msgbox DateAdd(d, 254,'08/10/2001')
-
Aug 13th, 2002, 10:54 PM
#3
Thread Starter
Addicted Member
follow up
Hi,
What if I have no Idea that it is August 10. I just know that its 254 days of the year 2001. My calculation is wrong coz Feb is only 28 or 29 days. How about if its a leap year.
Pls reply.
-
Aug 13th, 2002, 11:01 PM
#4
Fanatic Member
function takes care of leap year... but u should have a base date to add...
-
Aug 13th, 2002, 11:02 PM
#5
The picture isn't missing
probably would be more like this:
msgbox DateAdd("d", 253,"01/01/2001") 'the beginning of the year + 253 days (accounts for the first day of the year)
Remember, if someone's post was not helpful, you can always rate their post negatively  .
-
Aug 14th, 2002, 12:21 AM
#6
Thread Starter
Addicted Member
Welllll....
Your solution returns a one month advance.
-
Aug 14th, 2002, 12:55 AM
#7
New Member
Hi There,
Doing a little date math I found that
253
-31 for all of January
222
-28 for all of Feruary
194
-31 for all of March
163
-30 for all of April
133
-31 for all of May
102
-30 for all of June
72
-31 for all of July
41
-31 for all of August
10
= september 10
Or alternatively
Code:
MsgBox DateDiff("d", "12/31/2000", "8/10/2001")
Yeilds a result of 222
Hope this helps,
J
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|