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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 08-31-2010, 08:28 PM   #1 (permalink)
Registered Member
 
Join Date: May 2008
Posts: 29
shebinc is an unknown quantity at this point
Default UIDatePicker to pick just date, not time

Hey guys, I have been working on a simple app that countdowns to a specific date that the user can choose using a date picker. The issue is that whenever you pick a date it counts down to the exact minute and second on that date.

For example: If it is currently 4:35 PM and I use the app to countdown to December 25th, it doesn't count down to December 25th 12:00 AM it counts down to December 25th 4:35 PM. Or if you choose the next day, it wouldn't count down till midnight but to 4:35 tomorrow.

Date Picker is set to only date so I don't know if I need to somehow covert it's date so that it looses the time info or that the time is set to a specific time (like 12:00 AM that day).

Any ideas?
shebinc is offline   Reply With Quote
Old 08-31-2010, 09:03 PM   #2 (permalink)
Use [code] tags please
 
Join Date: Jun 2009
Location: Jacksonville, FL
Posts: 410
timle8n1 is on a distinguished road
Default

This should help

Code:
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *today = [NSDate date];
NSDateComponents *dateComps = [calendar components:(NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit)
		fromDate:today];
NSDate *todayAtMidnight = [calendar dateFromComponents:dateComps];
timle8n1 is offline   Reply With Quote
Old 09-02-2010, 02:30 PM   #3 (permalink)
Registered Member
 
Join Date: May 2008
Posts: 29
shebinc is an unknown quantity at this point
Default

Thanks, I'm going to try that out. I think I'm just gonna start over from scratch since my attempts to fix this problem has caused my code to become so convoluted that I am having a hard time understanding it....
__________________
Me Apps:
Missing Phone
1337 Translator
Which Day is That
shebinc is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 349
7 members and 342 guests
dre, freewind, hain, HemiMG, lendo, mottdog, oceanlablight
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,657
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jenniead38
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:03 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0