views:

120

answers:

2

Hello, I have a datefield in flex with editable="true". When I type: 20-1-69 and I go to another field, it changes into 20-01-2069. but I don't want it to change into 2069. Is it possible to turn off this automatically change thing?

Thanks, JSMB

+1  A: 

In the past, when bytes where expensive, smart programmers used two digits to store the date. So a 60 was interpreted as an 1960 and all was wel.

Until the dreaded year 2000 was near, people started to panic, because computers would certainly stop to work and we would all die, or at least been cut from the Internet which is possibly worse.

So smart programmers were called to solve the problem.

Real smart programmers extended the number of digits to 4. But programmers that were self proclaimed smart, used the sliding window. 70 to 99 where interpreted as 1970-1999 and 0 to 69 was ineterpreted as 2000 to 2069. This of course solved the Y2K problem. But as you have found out, we have a 2070 problem.

The fun part is that, using this scheme, old guys like me are born in the future. Which makes us feel young again. So they probably did this on purpose.

Gamecat
A: 

You need to decide where you want the two-digit date to cut off between 1900 and 2000, and then perform some magic on the input.

Example: Cutoff is the year 1940

(pseudocode)

If twoDigitYear > 40
   fourDigitYear = "19" + twoDigitYear
Else
   fourDigitYear = "20" + twoDigitYear

This will give you years from 1941 to 2040.

Robert Harvey
thanks, but isn't there a way just to turn of the changing thingie in flex?
jsmb
Haven't found one. The Flex manuals don't appear to say anything about this. Nor do they mention what *their* cutoff is.
Robert Harvey
Anyway, without a cutoff, you could only represent dates from 1900 to 1999, or from 2000 to 2099. So it doesn't make much sense to just shut it off altogether.
Robert Harvey