Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 01-03-2010, 11:59 AM   #4 (permalink)
harrytheshark
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

No problem,
Code:
NSDateFormatter * newFormatter = [[NSDateFormatter alloc] init];
[newFormatter setDateFormat:@"dd mm yyyy"];
	
NSDate * endDate = [newFormatter dateFromString:@"04 01 2010"]; //This is the end date, this is what we're checking for
[newFormatter release];
	
NSDate * nowDate = [NSDate date];
	
if ([nowDate compare:endDate] == NSOrderedDescending){
   NSLog(@"expired");
   //Show message, then quit
}
else
{
   NSLog(@"nope, still good");
   //It hasn't expired yet.
}
I created endDate in the way shown above just as a quick example and doesn't have a time or anything, just a date. The important bit is the comparison to see if the endDate has passed.

Tom
harrytheshark is offline   Reply With Quote
 

» Advertisements
» Online Users: 624
20 members and 604 guests
ADY, baja_yu, bignoggins, checkright, Davor, delldd, estherkt98, iAppDeveloper, ibrahimadnan, jbro, jstonebrook, MaestroApps, Meoz, Nobbsy, PixelEnvision, Pluvius, pranjalmahna, SLIC, Steve Shanks, TheStalker
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,422
Threads: 94,020
Posts: 402,548
Top Poster: BrianSlick (7,978)
Welcome to our newest member, iAppDeveloper
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:55 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.