Hi Genkush, The issue got resolved. In the PLIST file if we set the "valueType=T" then the issue got resolved. Now we are getting the hours, minutes and seconds along with the date.
Following is the corrected code snippet: (the valueType was not specified before) { allowsNull = Y; columnName = STS_ELAPSED_TIME; externalType = DATE; name = elapsedTime; valueClassName = NSCalendarDate; valueType = T; }, Regards, Raghu. On 24-Jun-2011, at 1:37 PM, Кушнир Геннадий wrote: >> But when I tried printing the fetched Object, the date fields of the object >> are printing as (2011-01-27 05:00:00 Etc/GMT), all the date fields hour, >> minutes and seconds are printing as 05:00:00, even though this value is >> different for different columns in the database. > > May be you have set wrong datatype for that field in your model or in > underlying database. > So your hours and minutes just get truncated. > 5:00 is you timezone? > > On 22.06.2011, at 17:29, Raghavender Bokka wrote: > >> Hi Team, >> >> I am trying to fetch the records using NSTimestamp values (that includes >> date, hours and minutes), and the data is fetched correctly based on the >> given date and time range parameters. >> >> But when I tried printing the fetched Object, the date fields of the object >> are printing as (2011-01-27 05:00:00 Etc/GMT), all the date fields hour, >> minutes and seconds are printing as 05:00:00, even though this value is >> different for different columns in the database. >> >> Please advise on how to fetch the date field values exactly including the >> hour and minutes. >> >> Following is the code snippet attached for reference: >> >> ------------------------------------------------------------------------------------------------------------------------ >> NSMutableArray qualifiers = new NSMutableArray(); >> >> GregorianCalendar calendarStartDate = new GregorianCalendar(); >> calendarStartDate.setTime(startingDate); >> >> int startDay = calendarStartDate.get(GregorianCalendar.DAY_OF_MONTH); >> int startMonth = calendarStartDate.get(GregorianCalendar.MONTH); >> int startYear = calendarStartDate.get(GregorianCalendar.YEAR); >> >> int startHour = 0; >> int startMinute = 0; >> >> if(reportParameters.valueForKey("startHour") != null) >> startHour = >> Integer.parseInt((String)reportParameters.valueForKey("startHour")); >> >> if(reportParameters.valueForKey("startMinute") != null) >> startMinute = >> Integer.parseInt((String)reportParameters.valueForKey("startMinute")); >> >> NSTimestamp startDate = new >> NSTimestamp(startYear,startMonth+1,startDay,startHour,startMinute,0,NSTimeZone.defaultTimeZone()); >> >> GregorianCalendar calendarEndDate = new GregorianCalendar(); >> calendarEndDate.setTime(stoppingDate); >> >> int endDay = calendarEndDate.get(GregorianCalendar.DAY_OF_MONTH); >> int endMonth = calendarEndDate.get(GregorianCalendar.MONTH); >> int endYear = calendarEndDate.get(GregorianCalendar.YEAR); >> >> int endHour = 0; >> int endMinute = 0; >> >> if(reportParameters.valueForKey("endHour") != null) >> endHour = >> Integer.parseInt((String)reportParameters.valueForKey("endHour")); >> >> if(reportParameters.valueForKey("endMinute") != null) >> endMinute = >> Integer.parseInt((String)reportParameters.valueForKey("endMinute")); >> >> NSTimestamp endingDate = new >> NSTimestamp(endYear,endMonth+1,endDay,endHour,endMinute,0,NSTimeZone.defaultTimeZone()); >> >> EOQualifier startDateQualifier = new >> EOKeyValueQualifier("elapsedTime",EOQualifier.QualifierOperatorGreaterThanOrEqualTo,startDate); >> qualifiers.addObject(startDateQualifier); >> >> EOQualifier stopDateQualifier = new >> EOKeyValueQualifier("elapsedTime",EOQualifier.QualifierOperatorLessThanOrEqualTo,endingDate); >> qualifiers.addObject(stopDateQualifier); >> ..... >> >> EOFetchSpecification stsFetchSpecification = new >> EOFetchSpecification(<ENTITY-NAME>,new EOAndQualifier(qualifiers),null); >> NSArray entityObjects = >> editingContext.objectsWithFetchSpecification(stsFetchSpecification); >> ...... >> ---------------------------------------------------------------------------------------------------------------------------------- >> >> Regards, >> Raghu. >> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/webobjects-dev/genkush%40rujel.net >> >> This email sent to genk...@rujel.net >
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com