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

  • Home
  • SEARCH
  • 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 6808811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:00:06+00:00 2026-05-26T20:00:06+00:00

I am having a date format 16-11-2011. but I want to convert it into

  • 0

I am having a date format “16-11-2011”. but I want to convert it into “16 Nov”
I written the code for it but null value generates instead of the format “16 Nov”

for this I have written following code

NSDate *checkIn = [[NSUserDefaults standardUserDefaults]valueForKey:@"CHECK_1"];
    NSLog(@"Date: %@",checkIn);

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];

    [formatter setDateFormat:@"dd MMM"];
    NSString *checkInDate = [formatter stringFromDate:checkIn];
    NSLog(@"checkInDate:%@",checkInDate);

and the results display by nslog statements are as follows:

Date: 16-11-2011
checkInDate:(null)

so I am not able to convert it into the format which I want

plz help me to solve the problem.

  • 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-26T20:00:06+00:00Added an answer on May 26, 2026 at 8:00 pm

    I suspect that checkIn is a NSString not NSDate.
    Therefore, you would have to convert it to a NSDate first and then convert it back to the desired string format.

    NSString *checkIn = [[NSUserDefaults standardUserDefaults]valueForKey:@"CHECK_1"];
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"dd-MM-yyyy"];
    
    NSDate *checkInTempDate = [dateFormatter dateFromString:checkIn];
    
    [dateFormatter setDateFormat:@"dd MMM"];
    NSString *checkInDate = [dateFormatter stringFromDate:checkInTempDate];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble displaying Date s in the format I want in my
I having problems with DataGrid component: It shows en-US date-format (mm/dd/yyyy), but the CultureInfo.CurrentCulture
Am having problem in using simple date format for this: having date as 12/13/2011
I am having troubles converting a short Zulu date format to a NSDate Object.
Having code: Date::Date(const char* day, const char* month, const char* year):is_leap__(false) { my_day_ =
I am having a date column in my table and I want to fetch
I'm having a problem getting the right date format to be returned from my
I´m having a stupid problem with java.util.Date . I have this line of code,
Possible Duplicate: PHP: convert date format yyyy-mm-dd => dd-mm-yyyy [NOT IN SQL] Hope everyone
link text I'm having the same problem. My date format is MM/dd/yyyy. How do

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.