Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 914299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:41:47+00:00 2026-05-15T17:41:47+00:00

Task: Show a UIDatePicker and grab the selected date, then display the selected date

  • 0

Task: Show a UIDatePicker and grab the selected date, then display the selected date in a label (in the format of Day, Month, Year).

Current progress:

-(IBAction)pressButton:(id)sender
{
    NSDate *selected = [datePicker date];
    NSString *message = [[NSString alloc] initWithFormat:@"%@", selected];

    date.text = message;
}

This will display the date in the format of YYYY-MM-DD 23:20:11 +0100. I do not want to display the time. I also want to display the date in a different format.

Is it possible to access the individual components of the date picker ie. datePicker.month

Any solutions or links is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:41:47+00:00Added an answer on May 15, 2026 at 5:41 pm

    What you want is the descriptionWithCalendarFormat:timeZone:locale: method. See Apple’s description of the method.

    For instance, to display the date in just the YYYY-MM-DD format, you’d use:

    NSString *message = [selected descriptionWithCalendarFormat: @"%Y-%m-%d" timeZone: nil locale: nil]
    

    I believe the format string here uses the same tokens as strptime from the C standard library, but there may be some minor discrepancies, knowing Apple. A description of that format is here.

    You could also use the NSDateFormatter class’ stringFromDate: method. It uses a different format (the Unicode format). I believe it is the “preferred” way to format date strings in Objective C, but it’s probably a bit more complicated to use as well.

    Finally, see this SO question for information on extracting individual NSDate components.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I show a progress dialog with an asynchronous task. private class RetrieveTask extends AsyncTask<String,
I want to show a pop-up message after completing my current task, which is
G'day there! I have task like show how many time was gone from message
I need to do simple task : show 2 datepickers : one - by
I have a task to show digital clock (with minutes precision) on HTML page
My task for this evening is to show and hide a div (eventually two
It's possible to show/hide the application's icon from both the Dock and the Task
I'm using UISplitViewController for app on iPad. The first task was to show master
My Lenovo laptop has two task bar type programs that show the network status
It is an easy task to find MySQL variable values: mysql> show variables where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.