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 7495297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:01:19+00:00 2026-05-29T18:01:19+00:00

I have data coming to my app which is a date stored in a

  • 0

I have data coming to my app which is a date stored in a string as follows:
“Tuesday 31st January 2011 10:15am”.

I have tried using dateFromString, and then NSDateFormatter to change it into another format (ideally I would like it displayed as hh:mm (24 hour) dd/mm/yyyy). I cannot find a way to remove the weekday name, and so whenever I try to print the result it comes out as null.

NSDateFormatter *df = [[NSDateFormatter alloc] init];
//is EEEE is for weekdays?

[df setDateFormat:@"EEEE-dd-MM-yyyy hh:mm a"];

NSDate *myDate = [df dateFromString:[[_feeds[_currentTableView] objectAtIndex:row] objectForKey:@"created"]];

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"dd-MM-yyyy"];

NSDateFormatter *timeFormat = [[NSDateFormatter alloc] init];
[timeFormat setDateFormat:@"HH:mm"];

NSDate *now = [[NSDate alloc] init];

NSString *theDate = [dateFormat stringFromDate:myDate];
NSString *theTime = [timeFormat stringFromDate:myDate];

NSLog(@"\n"
      "theDate: |%@| \n"
      "theTime: |%@| \n"
      , theDate, theTime);

[dateFormat release];
[timeFormat release];
[now release];

Can anyone help out? Thanks

  • 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-29T18:01:22+00:00Added an answer on May 29, 2026 at 6:01 pm

    You should isolate the problem to either parsing or formatting. My guess is that it’s the parsing. Here’s your sample string:

     "Tuesday 31st January 2011 10:15am"
    

    And your format:

     "EEEE-dd-MM-yyyy hh:mm a"
    

    They don’t match:

    • There are no hyphens in your sample text
    • There’s “st” after “31” – I’m not sure how you’ll handle that
    • The month is given as a name, not a number, so I suspect you want “MMMM” (if iOS’s format specifiers are like other ones I’m familiar with)
    • There’s no space between “15” and “am”

    Leaving aside the “st” part, I suspect you’d want a format of:

     "EEEE dd MMMM yyyy hh:mma"
    

    … but I don’t know how you’ll deal with the “st” (or “th” or “nd”) elegantly, other than by just messing with the string explicitly.

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

Sidebar

Related Questions

I have an app which is displaying a data set which allows me to
I have an HTML/JavaScript Adobe AIR app which needs to be listening for data
i have a long list selector in which i'm displaying data sorted by date.
When I try to build my Core Data App, which most code is coming
I have data coming from the database in the form of a DataSet .
I have data coming into my Model, how do I setup to insert the
I have a table in C#, the data is coming from an Excel file.
I have some scientific image data that's coming out of a detector device in
I have data from a table in a database (string) that contain text and
I learning Python (coming from a dotnet background) and developing an app which interacts

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.