Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358495 - dateTimeLib.dateFromInt returning wrong date
Summary: dateTimeLib.dateFromInt returning wrong date
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-21 17:23 EDT by broy2 CLA
Modified: 2017-02-23 14:18 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description broy2 CLA 2011-09-21 17:23:08 EDT
dateTimeLib.dateFromInt
This function should create a date using int as a number of days after a starting point date.
The EGL code says: the number of days after December 31, 1899.
Tim suggested I enter 0 for int.  That returned 1969-12-31.
So he said that was the starting point.
Then I changed the value of int and got unexplained results.  It was working as expected until I changed int from 24 to 25.
24 returned 1970-01-24.
25 returned 1969-12-07.  Huh??
Any value > 24 doesn't return the expected date.

int =    0, expecting 1969-12-31:   1969-12-31 19:00:00.000000
int =   10, expecting 1970-01-10:   1970-01-10 19:00:00.000000
int =   17, expecting 1970-01-17:   1970-01-17 19:00:00.000000
int =   24, expecting 1970-01-24:   1970-01-24 19:00:00.000000
int =   25, expecting 1970-01-25:   1969-12-07 01:57:12.704000
int =   31, expecting 1970-01-31:   1969-12-13 01:57:12.704000
int =  365, expecting 1970-12-31:   1970-01-17 19:40:28.928000

Notice int=365 returns same date as int = 17.

And the HH:mm:ss.SSSSSS (which should not be part of type DATE) changes after int=24. 

	myDate = dateTimeLib.dateFromInt(0);
	sysLib.writeStdout("int =    0, expecting 1969-12-31:   " + myDate);	
	myDate = dateTimeLib.dateFromInt(10);
	sysLib.writeStdout("int =   10, expecting 1970-01-10:   " + myDate);
	myDate = dateTimeLib.dateFromInt(17);
	sysLib.writeStdout("int =   17, expecting 1970-01-17:   " + myDate);	
	myDate = dateTimeLib.dateFromInt(24);
	sysLib.writeStdout("int =   24, expecting 1970-01-24:   " + myDate);
	myDate = dateTimeLib.dateFromInt(25);
	sysLib.writeStdout("int =   25, expecting 1970-01-25:   " + myDate);	
	myDate = dateTimeLib.dateFromInt(31);
	sysLib.writeStdout("int =   31, expecting 1970-01-31:   " + myDate);	
	myDate = dateTimeLib.dateFromInt(365);
	sysLib.writeStdout("int =  365, expecting 1970-12-31:   " + myDate);
Comment 1 Matt Heitz CLA 2011-09-22 06:56:03 EDT
I don't know what Tim was thinking.  There's no good reason to make the function work differently in EDT.  dateFromInt(0) should return December 31, 1899.
Comment 2 Jeff Douglas CLA 2011-09-22 10:34:09 EDT
fixed
Comment 3 broy2 CLA 2011-09-23 11:02:41 EDT
dateFromInt is working as expected now.
But the start date is still 1969-12-31.
Is that what we want, or do we want December 31, 1899?
Somebody please make a ruling.
Comment 4 Matt Heitz CLA 2011-09-27 14:37:35 EDT
Brian decided we should go with 12/31/1969.
Comment 5 broy2 CLA 2011-09-29 09:54:50 EDT
Verified in 20110929 build.