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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:18:00+00:00 2026-06-14T19:18:00+00:00

So I am writing the program in xcode that syncs with a database on

  • 0

So I am writing the program in xcode that syncs with a database on a different server, but the information to update is dependent on the date last synced. What is the best way to save a “dateLastSynced” timestamp so that when I open the program it can automatically sync the changes that happened after the datestamp?

  • 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-14T19:18:01+00:00Added an answer on June 14, 2026 at 7:18 pm

    Clearly [NSDate date] gets you the current date in NSDate format, but if you’re logging it in a SQLite database, you could also use the appropriate SQLite date and time function, for example SELECT datetime();.

    But, if you’re using this timestamp as a parameter you use in your remote web service requests (i.e. a timestamp that the server is going to check against it’s own internal clock and timestamped records), I’d suggest you do not use your local clock at all. Determine the dateLastSynced from the timestamps you received from that server and not use your local clock at all. Effectively, you let your web server’s timestamp mechanisms govern the process. Thus, you’d grab the appropriate timestamp field from the remote server and store that in your database’s dateLastSynced timestamp. The key is, you don’t want a minor misadjustment of clocks (or worse, sloppy time zone management) to adversely affect your syncing logic.

    Personally, when I’m coordinating the sync between a remote database and my local database, I generally have a one-row table in my local database for configuration information, and I store this server-based timestamp there. You certainly could use NSUserDefaults (see Preferences and Settings Programming Guide) or a plist or whatever, but I personally view this sync timestamp as a property of the state of my local database, so I therefore I feel more comfortable keeping it there. If you keep it elsewhere, do so with some consideration of other processes that could update your database (e.g. what’s your migration plan when the user updates their app to version 2.0 with a new/modified data structure).

    So, for what it’s worth, I personally would keep database synchronization information in the database itself, even if it feels silly to have that one row configuration table. (As an aside, I also tend to include fields like app/database version numbers in my configuration table, too.)

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

Sidebar

Related Questions

I am trying to begin writing a Java program in Xcode 4.4 but, At
I'm writing a program using Xcode for school that requires we use the open()
I have tried writing program that plays a sound file but have been unsuccessful
I'm new to C but trying some system calls. I'm writing program that iterates
I am writing a C++ program that uses Boost, using XCode 4.1 as IDE
Im writing a program that should read input via stdin, so I have the
I'm writing a program that handles DBs and writes any changes into ListView for
I am currently writing a program using Weka that builds a model (using one
I'm writing a program that's parsing an XML file to java objects using smooks.
I'm writing a program that reads huge file (3x280 GB) and does a fitting

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.