• Sign in to Neowin Faster!

    Create an account on Neowin to contribute and support the site.

  • 0
Sign in to follow this  

iOS Date Conversion and Formatting in Obj-C

Question

Brian Miller    1,629

I'm new to Objective-C and I need your help on converting a number to a legible date value and am not sure how to do it.

 

I have an NSNumber that looks like this: 20170624162459 (It's a numeric only format of the ISO 8601 date format "YYYYMMDDHHmmSS").

And I would like it converted in to an NSString like: 24th of June, 2017. 4:24 PM.

 

Can someone help to convert the number for me? I'm at a total loss and don't know Objective-C well enough to make a function to do this.

Thanks.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
Brian Miller    1,629

Anyone?

Share this post


Link to post
Share on other sites
  • 0
Above The Gods    453

NSNumber *date = @20170624162459;

NSString *stringDate = [date stringValue];

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.