Click here to Skip to main content
12,827,765 members (45,811 online)
Rate this:
Please Sign up or sign in to vote.
See more: Mobile Android
I want to convert this objective c code to equivalent to pure android in java.

This is " objective c " code:

frDateStr=[NSString stringWithFormat:@"1505%d",theYear];
toDateStr=[NSString stringWithFormat:@"0109%d",theYear];

fromDate=[dFormatter dateFromString:frDateStr];
toDate=[dFormatter dateFromString:toDateStr];

fromInter=[fromDate timeIntervalSinceReferenceDate];
toInter=[toDate timeIntervalSinceReferenceDate];
currDateInter=[[NSDate date] timeIntervalSinceReferenceDate];

//Current date exists when :
//If currentdate interval is greater or equal to fromdate interval..
//or if currentdate interval is less or equal to todate interval
if([yearName isEqualToString:@"Senior"])
    if((int)currDateInter >= (int)fromInter && (int)currDateInter <= (int)(toInter))

        if(![self.ignoredArray containsObject:@"Freshman Budget"] && [yearName isEqualToString:@"Senior"])
            [self.currentRemindersArray addObject:@"Freshman Budget"];



Can anyone help me please? Thank you.
Posted 26-Aug-12 21:49pm
Updated 26-Aug-12 23:42pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Here is the solution:For Android equivalent.

String startingFrom = "05-15-"+ currentYear;
			String endingDate = "09-10-"+ currentYear;
		 	SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
		    Date CurrentDate = new Date();
		    Date fromConvertedDate = new Date();
			Date toConvertedDate = new Date();
			try {
				fromConvertedDate = dateFormat.parse(startingFrom);
				toConvertedDate = dateFormat.parse(endingDate);
				//CurrentDate =dateFormat.parse(CurrentDatei);
			} catch (ParseException e) {
				// TODO Auto-generated catch block
		 	if (yearName.equalsIgnoreCase("Senior")) {

				if (CurrentDate.after(fromConvertedDate)
						&& CurrentDate.before(toConvertedDate)) {
      // Freshman Budget
					Cursor cursorC = myDbHelper.retrieveAllReminders("Freshman Budget ");
					if (cursorC.moveToFirst()) {
							ReminderVO reminderVO = new ReminderVO();

 							String data = cursorC.getString(cursorC
							String data1 = cursorC.getString(cursorC

							listView.setAdapter(new CustomListAdapter(this,


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170326.1 | Last Updated 18 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100