Welcome to iPadForums.net Guest - Click Here to Register

iPad internal date format

This is a discussion on iPad internal date format within the iPad Help forums, part of the Apple iPad Discussions category; I hope this is the right forum section for this, be kind mods if it's not . I've been using Notes app for around 2 ...

iPadForums.net is the original Apple iPad Forum! Registered Users do not see these ads. Please Register - It's Free!
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    iPF Noob
    Member #
    228152
    Join Date
    Jul 2012
    Posts
    7

    iPad internal date format

    I hope this is the right forum section for this, be kind mods if it's not .

    I've been using Notes app for around 2 years and want to bulk export the stored notes for inclusion in a database backend for a web based CMS. The simplest method I could find, that didn't involve being forced to use a dfferent third party app with its own proprietary data format, or other equally loathsome exercises in dodgy marketing, was:

    back up my iPad to my desktop running OSX

    use iPad / iPhone Backup Extractor to export the raw data from the back up on my desktop,

    then SQLite Database Browser to create a CSV file of the notes data.


    [strikethrough] (sorry all, apparently being new to the forums I can't include links for the above apps, anyone interested can pm me for links)[/strikethrough]

    The next step would be to simply filter out any data I don't need from the CSV file and upload to the the database. So far so groovy. All I really need from the data is the note contents and the creation date, and here I hit a snag - the creation date is stored as a string like this "308718186", which, for the example given, is displayed by Notes as "14 Oct 2010". On OSX I'd simply treat the digits as seconds passed since 1st January 1970 (aka the Unix epoch) to get the date, but far as I can tell this is not the case for iOS.

    So what is it the internal date format for iOS, anyone?
    Last edited by Osxy; 07-18-2012 at 07:23 AM. Reason: I'm now able to add links

  2. Ads


  3. #2
    iPF Noob
    Member #
    228152
    Join Date
    Jul 2012
    Posts
    7
    I've been digging about and come up with the answer to my own question - Cocoa's internal date format is :

    the number of seconds since 1 January, 2001, at 00:00

    Working with Date and Time in Cocoa (Part 1) ? Ole Begemann
    So basically this is the OSX (and therefor iOS) epoch, while the Unix epoch starts on 1 January, 1970, at 00:00.
    Last edited by Osxy; 07-17-2012 at 03:04 PM.

  4. #3
    iPF Noob
    Member #
    228152
    Join Date
    Jul 2012
    Posts
    7
    For the heck of it - here's the answer in perl code (using stock vanilla perl):


    first getting the difference between the 2 epochs:

    Code:
    #!/usr/bin/perl -w
    
    use strict;
    use Time::Local;
    
    
    # timelocal() coverts human readable dates into the sum of the date in seconds 
    # though it expects the date to be formatted as SECONDS,MINUTES,HOURS,DAY,MONTH,YEAR
    
    my $unixEpoch=timelocal(0,0,0,1,1,1970); #00:00 1st January 1970
    my $osxEpoch=timelocal(0,0,0,1,1,2001); #00:00 1st January 2001
    
    my $epochOffset=($osxEpoch - $unixEpoch);
    
    print $epochOffset,"\n";
    The above ouputs "978307200", the 31 year difference between the 2 epoch times in seconds, which I can use to get a human readable date from the stored Notes creation date:

    Code:
    #!/usr/bin/perl -w
    
    use strict;
    use diagnostics-verbose;
    
    
    my $cocoaDate=308718186;
    my $unixOffset=978307200;
    print scalar localtime($cocoaDate+$unixOffset);
    the above script outputs the following date "Thu Oct 14 12:03:06 2010" which matches the date shown in the Notes interface on iPad.

    So right about now I'm feeling pretty happy as I expected this to be much more tortuous to solve.


    It's also worth stressing that following the steps outlined in my first post gives you access to all the data stored in your ipad without having to jailbreak it, and without forking out wads of cash for apps from companies trying to cash in on iPad data recovery issues caused by Apple's hermetic approach.

    Set your data free!

  5. #4
    iPF Legend
    Member #
    28530
    Liked
    1522 times
    Join Date
    Jan 2011
    Location
    Walla Walla, WA
    Posts
    15,430
    Nice, glad you solved it; and thanks for letting us know how you did it.

  6. #5
    iPF Noob
    Member #
    228152
    Join Date
    Jul 2012
    Posts
    7
    Thanks twerppoet, it wasn't documented (that I could find) so I thought it worthwhile writing down what I was doing.

    And to anyone in general I can better document the process for actually getting stuff out of the encrypted back up file without using iTunes - which includes any application files, phtots or mp3s saved on your iPad - leave a comment so I can judge interest in this.


Links

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Similar Threads

  1. Video format (format, filesize, resolution) recommendations for iPad
    By bat0nas in forum iPad General Discussions
    Replies: 5
    Last Post: 02-16-2013, 09:43 AM
  2. Converting a text book into an Ipad format and/or kindle format
    By Johnplatero in forum New Member Introductions - Site Assistance
    Replies: 3
    Last Post: 07-18-2012, 02:02 PM
  3. UK Date format
    By DavidSG1140 in forum iPad Help
    Replies: 2
    Last Post: 07-10-2012, 04:19 AM
  4. How do I disable internal iPad mic?
    By hamdogg in forum New Member Introductions - Site Assistance
    Replies: 4
    Last Post: 01-20-2012, 08:13 PM
  5. iPad 1 gen internal mic pressure contact???
    By Luchura in forum iPad DIY
    Replies: 4
    Last Post: 10-02-2011, 04:27 PM

Search tags for this page

data format on ipad
,
date format for ipad
,

date format ipad

,
date string format for ipad
,
internal date format
,
ios internal file creation date format
,
ipad data format
,

ipad date format

,
ipad email date format
,
ipad html date formatting
,
ipad mail format
,

iphone internal date format

Click on a term to search for related topics.