Leapyear bug VB 3.0 
Author Message
 Leapyear bug VB 3.0

Well well...I just LOVE these kinds of things...VB 3.0 (probably 4.0
too) has a nifty little bug in the "Now" function....while it's still
leapyear, try this:

?Format$(Now,"#")

You'll get 34125...Now try

?Format$("03/01/96","#")

Guess what...it's 34125.  So,

?Format$(Format(Now,"#"),"MM/DD/YY") results in 03/01/96.

WONDERFUL...*THANK YOU* Microsoft...My accounting program is HOSED.

--
Robert Simpson
Programmer at Large
BC Software
Phoenix, AZ



Mon, 17 Aug 1998 03:00:00 GMT  
 Leapyear bug VB 3.0

Quote:

>Well well...I just LOVE these kinds of things...VB 3.0 (probably 4.0
>too) has a nifty little bug in the "Now" function....while it's still
>leapyear, try this:
>?Format$(Now,"#")
>You'll get 34125...Now try

        I got 35124

Quote:
>?Format$("03/01/96","#")
>Guess what...it's 34125.  So,
        I got 35124
>?Format$(Format(Now,"#"),"MM/DD/YY") results in 03/01/96.

        I got 02/29/96

to recap my results in VB3, VB4 -16 and VB4 32 were:

        February 29, 1996 -> 35124 -> 02/29/96
        March 1, 1996      -> 35125 -> 03/01/96

Not that I'm a big fan of Microsoft, but I think you're barking up the
wrong tree!

Jeff



Tue, 18 Aug 1998 03:00:00 GMT  
 Leapyear bug VB 3.0

Quote:

>Well well...I just LOVE these kinds of things...VB 3.0 (probably 4.0
>too) has a nifty little bug in the "Now" function....while it's still
>leapyear, try this:
>?Format$(Now,"#")
>You'll get 34125...Now try
>?Format$("03/01/96","#")
>Guess what...it's 34125.  So,
>?Format$(Format(Now,"#"),"MM/DD/YY") results in 03/01/96.
>WONDERFUL...*THANK YOU* Microsoft...My accounting program is HOSED.

Funny, it seems OK on my machine...

?format$(now,"#")
35124

?format$("03/01/96","#")
35125

?Format$(Format(Now,"#"),"MM/DD/YY")
02/29/96

?Format$(Format("03/01/96","#"),"MM/DD/YY")    
03/01/96

...zzzzzz....

-Doug



Tue, 18 Aug 1998 03:00:00 GMT  
 Leapyear bug VB 3.0

Quote:

>Well well...I just LOVE these kinds of things...VB 3.0 (probably 4.0
>too) has a nifty little bug in the "Now" function....while it's still
>leapyear, try this:
>?Format$(Now,"#")
>You'll get 34125...Now try

        I got 35124

Quote:
>?Format$("03/01/96","#")
>Guess what...it's 34125.  So,
        I got 35124
>?Format$(Format(Now,"#"),"MM/DD/YY") results in 03/01/96.

        I got 02/29/96

to recap my results in VB3, VB4 -16 and VB4 32 were:

        February 29, 1996 -> 35124 -> 02/29/96
        March 1, 1996      -> 35125 -> 03/01/96

Not that I'm a big fan of Microsoft, but I think you're barking up the
wrong tree!

Jeff



Wed, 19 Aug 1998 03:00:00 GMT  
 Leapyear bug VB 3.0

(As a reply to everyone in this thread)

Quote:
>?Format$(Now,"#")
>You'll get 34125...Now try
>?Format$("03/01/96","#")
>Guess what...it's 34125.  So,
>?Format$(Format(Now,"#"),"MM/DD/YY") results in 03/01/96.
>WONDERFUL...*THANK YOU* Microsoft...My accounting program is HOSED.

I get these results too. This is the code I used (I have Norwegian date
settings, so don't comment on the day preceeding the month):

   Print Now
   Print Format$(Now, "DD/MM/YYYY")
   Print Format$(Now, "#")
   Print Format$("01/03/1996", "#")
   Print Format$(Format$(Now, "#"), "MM/DD/YYYY")

And these are the results:

Print Now:                                      29.02.96 12:52:50
Print Format$(Now, "#"):                        35125
Print Format$("01/03/1996", "#"):               35125
Print Format$(Format$(Now, "#"), "DD/MM/YYYY"): 01.03.1996

What gives?


--
Newbiehood is not a period of time, it's a way of life.

http://www.sn.no/~balchen
ftp://ftp.sn.no/user/balchen/



Wed, 19 Aug 1998 03:00:00 GMT  
 Leapyear bug VB 3.0

Quote:
>Well I using American Windows get
>Print Format$("02/29/1996", "#") = 35124
>Print Format$("03/01/1996", "#") = 35125
>Could this be a problem with non american Windows ?

No, I found out the problem is Now(). When I use your code, it returns the
correct values. But when I replace "02/29/96" with Now(), it returns the
wrong value.


--
Newbiehood is not a period of time, it's a way of life.

http://www.sn.no/~balchen
ftp://ftp.sn.no/user/balchen/



Fri, 21 Aug 1998 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Reporting a VB 3.0 Bug

2. VB 3.0 Pro File List Bug?

3. Bug/error with db-table vb 3.0

4. VB 3.0 Pen Edit InkWidth Bug?

5. VB 3.0 (problem/bug) when on NT?

6. Is this a VB 3.0 bug ?

7. VB 3.0 bugs?

8. VB 3.0 Menu Bug

9. Bug in VB 3.0

10. BUGS IN VB 3.0

11. Bugs in VB 3.0

12. VB 3.0 and grid control - bug?

 

 
Powered by phpBB® Forum Software