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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:16:09+00:00 2026-06-15T12:16:09+00:00

I would like to collect a date from the user, convert it to unix

  • 0

I would like to collect a date from the user, convert it to unix epoch time and use that epoch time stamp to replace the time stamp that follows the dateWithTimeIntervalSince1970: in my code. Any assistance is greatly appreciated, thank you!

-(void)updatelabel{
    NSCalendar *Calender = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];
    int units = NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
    NSDateComponents *components = [Calender components:units fromDate:[NSDate date] toDate:destinationDate options:0];
    [dateLabel setText:[NSString stringWithFormat:@"%d%c  %d%c  %d%c  %d%c", [components day], 'd', [components hour], 'h',   [components minute], 'm', [components second], 's']];  
}


- (void)viewDidLoad {
    [super viewDidLoad];
    destinationDate = [NSDate dateWithTimeIntervalSince1970:1356088260];
    timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updatelabel) userInfo:nil repeats:YES];
}
  • 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-15T12:16:11+00:00Added an answer on June 15, 2026 at 12:16 pm

    If you are asking how to collect a date from a user, the easiest way is to use a UIDatePicker. Assuming you are using Storyboards or NIBs, you’d drag the control from the Object Library and connect its “Value Changed” event with an action method.

    UIDatePicker

    Inside your action method, you could grab the date as:

    - (IBAction)dateSelected:(UIDatePicker *)picker {
        NSDate *selectedDate = picker.date;
        // ...
    }
    

    If, instead, you have an NSString from the user, you can use an NSDateFormatter to convert the string to an NSDate:

    NSString *usersDateStr = @"12/01/2012" // this would be retrieved from the user.
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"MM/dd/yyyy";
    NSDate *selectedDate = [formatter dateFromString:usersDateStr];
    

    Either way, once you have a date object, if needed, you can convert it to an NSTimeInterval with:

    NSTimeInterval time = [selectedDate timeIntervalSince1970];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to collect analytics on multiple visits from a logged in user,
I would like to create several Named Ranges in Excel that collect values in
I would like to collect all the <script> ....</script> code section present in the
I have various models of which I would like to keep track and collect
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to collect all css/js resources in a controller. This would result
We use MongoDB to collect logs on pageviews. $collection_name = logs..date('Y')...date('m')...date('d'); $collection = $this->Mongo->$collection_name;
When a view will disappear I would like to collect the values of some

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.