Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Leap Year

Aug
2,059
83
2012 is a leap year. Take note of the following;

Code:
echo %@date[02/29/2012]
11747

echo %@date[02/30/2012]
11748

echo %@date[02/31/2012]
11749

echo %@date[03/01/2012]
11748
February 30, 2012 returns the same number of days since January 1, 1980 as March 1, 2012.

Why are 02/30/2012 and 02/31/2012 being recognized as valid dates?

I'm using TCC 11.

Joe
 
| February 30, 2012 returns the same number of days since January 1,
| 1980 as March 1, 2012.
|
| Why are 02/30/2012 and 02/31/2012 being recognized as valid dates?

The @date function, at least as far back as V6, accepted the 31st day of
every month. The documentation never stated that it validates its input! Its
working principle is GIGO...
--
Steve
 
| February 30, 2012 returns the same number of days since January 1,
| 1980 as March 1, 2012.
|
| Why are 02/30/2012 and 02/31/2012 being recognized as valid dates?

The @date function, at least as far back as V6, accepted the 31st day of
every month. The documentation never stated that it validates its input! Its
working principle is GIGO...

Possibly of interest: http://www.unm.edu/~cdye/plugins/iso8601.html
 
Let me know if you find any UN-wanted incompatibilities. (Or worse yet, bugs.)
 

I love these new functions, Charles. Obviously, this supersedes your earlier pickdate plugin.

From the iso8601.html page:

"Formats 0 through 3 return two-digit years, for compatibility with Take Command's native behavior. Where compatibility is not an issue, I recommend using formats 256-259 instead. These formats are equivalent to 0-3, but return four-digit years. (A note in TakeCmd.h suggests that TCC supports similar formats internally; unfortunately, this capability doesn't seem to be available to the user.)"

In fact, in an earlier version of TC, I had noticed those formats 256-259 worked, and inquired whether I could depend on them. Rex said no, that they weren't valid formats, and they were removed from the next release.

Thanks, Charles, for making those available again.
 
Steve,


>> Why are 02/30/2012 and 02/31/2012 being recognized as valid dates?
>
> The @date function, at least as far back as V6, accepted the 31st day
> of every month. The documentation never stated that it validates its
> input! Its working principle is GIGO...

On the othe hand, there must be some internal test to decide that

echo%@makedate[11748]
01.03.12

and not 30.02.12.

At least you can use this to validate a given input date.

Best Regards,

* Klaus Meinhard *
<www.4dos.info>
 
Back
Top
[FOX] Ultimate Translator
Translate