[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Resend: Potential Y2K bugs: date conversions ASCII files



PureBytes Links

Trading Reference Links

Gentlemen and Melody,

Greetings from Charles Kaucher,
I hope you take the time to puruse the following it is hot off the press and
would like some feedback as to its correctness.

In a nutshell, importing ASCII dates in TS 4 produces unusable y2k results. 
While thankfully, I do not have source code for the internal workings of the
Charting module, it seems reasonable to assume that this product is not y2k
compliant.  I never thought I would alpha test a Y2K patch.    

At a minimum, 
Omega Research needs to rewrite the Easy Language(EL) functions to be
consistent.  Functions such as ELdatetoString need to accept all y2k compliant
dates and similarly they need to provide a way for y2k compliant dates to be
used by all date-based functions.  They could go a long way by providing a
compliantdatetoELdate function that would convert all y2k compliant dates. (I
know that sounds backwards of taking a Y2K compliant date and changing into a
noncompliant Julian equivalent) It would be better if they did it in C.  How
about a string parser to handle all the date formats?


What are y2k compliant dates?

Per the Omega Research Knowledge base
<http://www.omegaresearch.com/support/knowledgebase_main/knowledge_base_ful
l.asp?DocumentID=92>

They are as follows:

Dates can be presented in Y2K compliant formats and/or Y2K non-compliant
format. You can only use slashes or dashes to separate the day, month, & year.
And, if you use slashes or dashes, you don’t have to use the zeros (i.e., 01
can be 1, 02 can be 2, and so on). 
Y2K Compliant FormatExamples
MMDDYYYY01271996 or 01/27/1996 or 1-27-1996 
DDMMYYYY27011996 or 27/01/1996 or 27-1-1996 
MMYYYYDD01199627 or 01/1996/27 or 1-1996-27 
DDYYYYMM27199601 or 27/1996/01 or 27-1996-1 
YYYYDDMM19962701 or 1996/27/01 or 1996-27-1 
Y2K Non-compliant FormatsExamples
MMDDYY012796 or 01/27/96 or 1-27-96 
DDMMYY270196 or 27/01/96 or 27-1-96
MMYYDD019627 or 01/96/27 or 1-96-27 
DDYYMM279601 or 27/96/01 or 27-96-1
YYDDMM962701 or 96/27/01 or 96-27-1
Y2K non-compliant dates are interpreted based on the following algorithm: 
Years 00-20 = 2,000 numbers (e.g., 01 = 2001) 
Years 21-99 = 1,900 numbers (e.g., 98 = 1998)
Example of invalid date:
12796
No zero in month (01). You can correct it by adding“/” or “-“ such as 1/27/96
or 1-27-96. In this example, 96 is interpreted as 1996.
/////////////////////

Personally, I don't see how you could write date functions that could take all
these functions.

Further and has been pointed out by J.Rodney Grisham the documents state:
Documentation for the DateToJulian function says:

DateToJulian
Returns the Julian date of input value.  The input value must
be a valid date (January 1, 1900 to February 28, 2100).  The
value returned will be a number from 1 to 73049.


Category: Date & Time
Function: DateToJulian(num)
Example:  DateToJulian(860617) returns 31578

Ignoring the fact that this serialized date is quite distinct from
the true Julian date, there are errors galore.
a. It returns 2 for Jan 1, 1900, and its return values are 1 day 
   too large for all other days for which I have tested it which
   are relatively near to the year 1999.

b. It returns 7573 for Feb 28, 2100.  73049 would correspond to 
   Feb 28, 2100 if day 1 were Mar 1, 1900.  If day 1 was Jan 1, 1900
   as claimed, then it should actually return 73108, or with the 
   "one day off bug" for consistency it should be 73109.

c. The example is wrong.  DateToJulian(860617) returns 31580.
   The correct answer is 31579.  Neither matches the documentation.


Documentation for the JulianToDate function says:
JulianToDate 
Returns the date in YYMMDD format of the input Julian date.  
This input value may range from 1 (January 1, 1900) through 
73049 (February 28, 2100).

Category: Date & Time
Function: JulianToDate(num)
Example:  JulianToDate(31578) returns 860617

//////////////////

As a test of the above, I created an ASCII test file to perform a black BOX
type test.  I know what I put in and Therefore and I know what I should get
out.

The file was formatted as follows:

01/03/1900,1.12,1.12,1.12,1.12,19000103
02/02/1900,2.1,2.1,2.1,2.1,19000202
03/06/1900,3.1,3.1,3.1,3.1,19000306
04/05/1900,4.1,4.1,4.1,4.1,19000405
05/08/1900,5.1,5.1,5.1,5.1,19000508
06/07/1900,6.1,6.1,6.1,6.1,19000607
07/10/1900,7.1,7.1,7.1,7.1,19000710
08/09/1900,8.1,8.1,8.1,8.1,19000809
09/11/1900,9.1,9.1,9.1,9.1,19000911
10/11/1900,10.1,10.1,10.1,10.1,19001011
11/13/1900,11.1,11.1,11.1,11.1,19001113
12/13/1900,12.1,12.1,12.1,12.1,19001213
01/15/1901,13.1,13.1,13.1,13.1,19010115
02/14/1901,14.1,14.1,14.1,14.1,19010214
03/19/1901,15.1,15.1,15.1,15.1,19010319
04/18/1901,16.1,16.1,16.1,16.1,19010418