dtucker
asked on
formatting for Y2K
I am currently using the Lost_Focus event in a textbox and formatting the date as:
Format(y2kcheck$, "m/d/yyyy"), but if the user enters 03/03/00 the output is 3/3/1900,
How can I change the code to make it 3/3/2000?
Code please...
Format(y2kcheck$, "m/d/yyyy"), but if the user enters 03/03/00 the output is 3/3/1900,
How can I change the code to make it 3/3/2000?
Code please...
ASKER
I am using vb4 16 bit.
I could even break down the date and replace 1900 with 2000 if there is not a FORMATing way to do it.
Code Please...
Thank you for your prompt response.
Dave
I could even break down the date and replace 1900 with 2000 if there is not a FORMATing way to do it.
Code Please...
Thank you for your prompt response.
Dave
What we are seeing here is inherent behavior designed into the date datatype.
My understanding of how Microsoft decided to handle 2-digit years, was this.
any 2-digit year from 00 to 29 is considered 20th century (i.e. 2000, 2019, 2029)
any 2-digit year from 30 to 99 is considered 19th century (i.e. 1930, 1968, 1999)
(Tested them out here, and it worked as expected)
Try these examples (00,29,30,99) out and please post your results. That will help us see what's going on to better solve your dilemma.
My understanding of how Microsoft decided to handle 2-digit years, was this.
any 2-digit year from 00 to 29 is considered 20th century (i.e. 2000, 2019, 2029)
any 2-digit year from 30 to 99 is considered 19th century (i.e. 1930, 1968, 1999)
(Tested them out here, and it worked as expected)
Try these examples (00,29,30,99) out and please post your results. That will help us see what's going on to better solve your dilemma.
Also, what database are you using? Perhaps the database isn't Y2K compliant?
ASKER
My database is just a random file database, which isn't Y2K compliant.
if I type 3/3/00 I get 3/3/1900
if I type 3/3/30 I get 3/3/1930
So I have to find a way to check for the 00 in my date field and translate that to 2000, as well as 01 as 2001 etc.
Right now if someone types in 3/12/98 it returns 3/12/1998, so all is fine until the year 2000.
Any thought as how to do the check and conversion in vb4 16-bit?
if I type 3/3/00 I get 3/3/1900
if I type 3/3/30 I get 3/3/1930
So I have to find a way to check for the 00 in my date field and translate that to 2000, as well as 01 as 2001 etc.
Right now if someone types in 3/12/98 it returns 3/12/1998, so all is fine until the year 2000.
Any thought as how to do the check and conversion in vb4 16-bit?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Tried the following in the immediate window:
?format("03/03/00","mm/dd/
03/03/2000
Put it at 2000, for me. Any other information?