ObjectUtil.dateCompare() function does account for the time portion of the supplied dates.
According to the scenario you describe ObjectUtil.dateCompare() function never sees the time portion of date_A nor date_B. The DateField.stringToDate() method only evaluates the YYYY-MM-DD portion of the supplied date string and ignores/strips off the time portion of the date. Regards, Keith Reinfeld Home Page: <http://keithreinfeld.home.comcast.net/> http://keithreinfeld.home.comcast.net From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On Behalf Of powers Sent: Monday, November 16, 2009 2:29 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Comparing Dates: ObjectUtil.dateCompare not working I'm writing a sort compare function to sort by date. The date format is YYYY-MM-DD HH:NN:SS. I'm converting the dates, in a string format, to a Date objects like so: DateField.stringToDate(date_A 'YYYY-MM-DD HH:NN:SS'); DateField.stringToDate(date_B 'YYYY-MM-DD HH:NN:SS'); Then comparing the dates like this: ObjectUtil.dateCompare(date_A, date_B) It always returns 0 when the date portion of the two date objects are equal, but the times are different. Does the ObjectUtil.dateCompare function not account for the time? -- View this message in context: http://old.nabble.com/Comparing-Dates%3A-ObjectUtil.dateCompare-not-working- tp26378917p26378917.html Sent from the FlexCoders mailing list archive at Nabble.com. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.5.425 / Virus Database: 270.14.67/2506 - Release Date: 11/16/09 07:43:00
<<image001.jpg>>
<<image002.jpg>>