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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to