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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:16:34+00:00 2026-05-21T19:16:34+00:00

What is the best format to store a date in, for easy formatting later

  • 0

What is the best format to store a date in, for easy formatting later using the Objective-C dateformatter? The date will start as a unix timestamp, then become whatever format is most easily worked with, stored in an SQLite3 db, then retrieved and manipulated with a dateformatter. Can I just use a timestamp? Or is it better to convert it into, say, YYYY/mm/dd, or something along those lines.

  • 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-21T19:16:34+00:00Added an answer on May 21, 2026 at 7:16 pm

    I think you’ll want to store it in format YYYYMMDDHHMMSS for easy sortability.

    Are you writing sqlite code directly? Why not use a managed data framework such as Core Data (underlying data store is sqlite), would make your life much easier. This little example uses NSSortDescriptor to sort by FileDate column. AssetItem is an NSManagedObject subclass

    NSFetchRequest *nsrequest = nil;
    NSEntityDescription *entity = nil;
    
    NSError *error; 
    
    // check to see if the scene exists (could have been downloaded previously)
    nsrequest = [[NSFetchRequest alloc] init];
    entity = [NSEntityDescription entityForName:@"AssetItem" inManagedObjectContext:managedObjectContext];          
    [nsrequest setSortDescriptors:[NSArray arrayWithObject:[[[NSSortDescriptor alloc] initWithKey:@"FileDate" ascending:NO] autorelease]]];     
    [nsrequest setEntity:entity];
    
    NSArray *objs = [[managedObjectContext executeFetchRequest:nsrequest error:&error] retain];
    
    for (AssetItem *item in objs) {
        NSLog(@"file date is: %@", [item FileDate]);
    }
    [objs release];
    [nsrequest release]
    

    ;

    You can do much modeling using the built-in Xcode data modeler tools.

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

Sidebar

Related Questions

What is the best format to store images in a database, such as binary,base64...etc,
What is the best (date format independent way) in PHP to calculate difference in
Similar to What is the best format to store test data in a file?
I have to store date values ( TDateTime ) in a string format. What
What's the best way to store an image in a database in binary format,
I'm using time() to store date in the database. I have some kind of
What would be the best format to numerically represent a color in .NET so
I need to save WPF FlowDocuments to SQL Server. What is the best format
What is the best currency format to use in my database in conjunction with
When designing a website, what do you consider the best image format to use

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.