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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:28:52+00:00 2026-06-12T19:28:52+00:00

Hi I have made a code which gives me an url with a date

  • 0

Hi I have made a code which gives me an url with a date at the end like http://www.google.com/2012-10-09

But for some reason it doesn’t redirect me to the correct url?
It seems like there is some problem understanding NSURL URLwithstring?

Here is my code

- (IBAction)sedato:(id)sender {



    //Finds date and make string



    NSDate *ddato = [_datepickout date];

    NSString *vdato = [NSString stringWithFormat:@"%@", ddato];


    NSDateFormatter *datoform = [[NSDateFormatter alloc] init];
    [datoform setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
    [datoform setDateFormat: @"yyyy-MM-dd HH:mm:ss Z"];

    NSDate *datemedform = [datoform dateFromString: vdato];
    NSString *strdate = [[NSString alloc] initWithFormat:@"%@", datemedform];
    NSArray *arr = [strdate componentsSeparatedByString:@" "];
    NSString *endelig;
    endelig = [arr objectAtIndex:0];

    NSArray *arr2 = [endelig componentsSeparatedByString:@"-"];
    NSString *year;
    year = [arr2 objectAtIndex:0];
    NSString *mm;
    mm = [arr2 objectAtIndex:1];
    NSString *dag;
    day = [arr2 objectAtIndex:2];

   NSString *url = [NSString stringWithFormat:@"http://www.coutbound.dk/logon/add_date.asp?view_date=%@/%@/%@",year,mm,day];



//Send url request with string     


    ASIFormDataRequest *request2 = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];

    [request2 setUseKeychainPersistence:YES];
    [request2 setUseCookiePersistence:YES];
    [request2 setDelegate:self];
    [request2 startAsynchronous];




}
    - (void)requestFinished:(ASIHTTPRequest *)request {
        NSLog(@"Saved form successfully");
        NSLog(@"Response was:");
        NSLog(@"%@",[request responseString]);
        NSLog(@"HEADERS: %@",[request responseHeaders]);
        NSLog(@"STATUSCODE: %u",[request responseStatusCode]);
        NSLog(@"COOkies: %@",[request responseCookies]);
    }
  • 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-06-12T19:28:53+00:00Added an answer on June 12, 2026 at 7:28 pm

    You are converting the date to string, then back to date, back to string, to components then again to string! There must be an error somewhere.

    Try this instead:

    NSDate *myDate = [_datePicker date];
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"yyyy/MM/dd";
    NSString *dateStr = [formatter stringFromDate:myDate];
    NSString *url = [NSString stringWithFormat:@"%@%@", urlBase, dateStr];
    

    Check the result with

    NSLog(@"URL: %@", url);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made a YUI module a little like the code shown below, which
Greetings, SO. I have some code which I've made attempts at compiling using gcc,
I have a line, which is a sprite made by using this code CGPoint
I have made a simple code for ajax to call a page but it
Thank everyone for the help I have made some really good changes but now
I have made a code that read data from flash Nand (without filesystem). fd
I have made a code where I have to input 1 . no of
I have made a code for scrolling a background in Cocos2d to create an
I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
I have made this code to open a database(created in SQLite browser) stored in

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.