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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:55:01+00:00 2026-05-13T19:55:01+00:00

I have an issue with date Formatter. I have Two string. one string contains

  • 0

I have an issue with date Formatter.

I have Two string. one string contains date in form of MM/dd/yyyy; and second string contains time in form of hh:mm a.

Now i want to concatenate this two strings and want output as a new strings in form of
yyyy-MM-dd HH:mm:ss.

I have tried following but unfortunately it doesn’t work more.

-(NSString *)ConcateDateAndTime:(NSString *)date Time:(NSString *)time{

    date = [date stringByAppendingFormat:@" %@",time];



    NSDateFormatter *formater = [[NSDateFormatter alloc]init];
    [formater setDateFormat:@"MM/dd/yyyy hh:mm aa"];

    NSDate *dt = [NSDate date];
    dt = [formater dateFromString:date];

    NSDateFormatter *formater1 = [[NSDateFormatter alloc]init];
    [formater setDateFormat:@"yyyy-MM-dd HH:mm:ss"];

    NSString *temp;
    temp = [formater1 stringFromDate:dt];

    return temp;

}
  • 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-13T19:55:01+00:00Added an answer on May 13, 2026 at 7:55 pm

    Use this instead as you’ve also got a memory leak:

    -(NSString *)ConcateDateAndTime:(NSString *)date Time:(NSString *)time{
    
        date = [date stringByAppendingFormat:@" %@",time];
    
        NSDateFormatter *formater = [[[NSDateFormatter alloc] init] autorelease];
        [formater setDateFormat:@"MM/dd/yyyy hh:mm aa"];
    
        NSDate *dt = [formater dateFromString:date];
    
        [formater setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    
        return [formater stringFromDate:dt];
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 325k
  • Answers 326k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Go to Window >> Customize Perspective You should be on… May 14, 2026 at 1:36 am
  • Editorial Team
    Editorial Team added an answer Yes, calling dispose on the ObjectContext is sufficient to dispose… May 14, 2026 at 1:36 am
  • Editorial Team
    Editorial Team added an answer Yes, classic ASP can be developed just fine in VS2010… May 14, 2026 at 1:36 am

Related Questions

I have weather forecast data formatted like so: loc_id#location#state#forecast_date#issue_date#issue_time#min_0#max_0#min_1#max_1#min_2#max_2#min_3#max_3#min_4#max_4#min_5#max_5#min_6#max_6#min_7#max_7#forecast_0#forecast_1#forecast_2#forecast_3#forecast_4#forecast_5#forecast_6#forecast_7# 090180#Airey's Inlet#VIC#20091204#20091204#161830###12#19#12#21#12#19#12#17#11#20#12#20#11#17#Mostly clear.#Shower or two.#Light
Ever since British Summer Time ended in the UK last week my application has
I have an issue with a table containing three cells in one row. Two
can anyone help, I have an issue with the keyword this.. before entering the
I Have an odd issue with some JavaScript code (again, I hate debugging JS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.