Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355163 - Java string to date conversion is uisng YYYYmmdd egl.lang.EDate.egl specifies MMddyyyy
Summary: Java string to date conversion is uisng YYYYmmdd egl.lang.EDate.egl specifies...
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-08-18 16:10 EDT by Kathy Carroll CLA
Modified: 2017-02-23 14:17 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kathy Carroll CLA 2011-08-18 16:10:00 EDT
I expected this to work:

 qDay date = "06/28/1969";

not this:

 qDay date = "19690628";

================= EDT CODE ==================

program dateTester type BasicProgram {}
	
	function main()
		creation();
	end
	
	function creation()
	 // This should work
	  try
		expecting string = "06/28/1969";
		qDay date = expecting;
		actual string = qDay;
		If (actual == expecting)
			syslib.writeStdOut("MM/DD/YYYY Equal");
		else
			syslib.writeStdout("MM/DD/YYYY Different");
		end
	  onException(oops TypeCastException)
	  	 Syslib.writeStdOut(" Can't create date using MM/DD/YYYY");
	  	 creationworks();
	  end
	end
	
	function creationWorks()
		// this shouldn't work
		try
			expecting string = "19690628";
			qDay date = expecting;
			actual string = qDay;
			If (actual == expecting)
				syslib.writeStdOut("YYYYMMDD Equal");
			else
				syslib.writeStdout("YYYYMMDD Different");
			end
	   	onException(oops TypeCastException)
	  		 Syslib.writeStdOut(" Can't create date using YYYYMMDD");
	  	end
	end

end
Comment 1 Matt Heitz CLA 2011-08-24 22:43:43 EDT
I fixed this problem, but your testcase will fail due to a different bug.  The bug 355782 - Dates are converted to strings as if they were timestamp("yyyyMMdd")
Comment 2 Kathy Carroll CLA 2011-08-30 08:27:52 EDT
verified
Comment 3 Lisa Lasher CLA 2011-10-11 16:24:50 EDT
Closing this defect.