Ben In fact, I am converting a binary file to SQLite3, the file is in format as below: struct Stock { int day; int open; int high; int low; int close; double volume; };
and I use code as below to get NSDate with 2010-09-03 00:00:00 #define kSecondsRest 18 * 60 * 60 - 59 * 60 - 28 NSData *data = [NSData dataWithContentsOfFile:file options:0 error:&error]; struct Stock *stock = (struct Stock*)[data bytes]; int seconds = 86400 * (stock->day + 125913) - kSecondsRest; int hours = seconds / 3600; NSDate *date = [NSDate dateWithTimeIntervalSince1970:seconds]; --- Ben <sqlite_l...@menial.co.uk> wrote: > Mike, > > If you are using iOS, then presumably you are using the NSDate class. > If you are, then the easiest thing to do is store the result of > - (NSTimeInterval)timeIntervalSinceReferenceDate . This stored value > can be turned back into an NSDate using [NSDate > dateWithTimeIntervalSinceReferenceDate:] > > The type of NSTimeInterval is a double. This can be stored easily and > has good precision (see > http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_DataTypes/Reference/reference.html#//apple_ref/c/tdef/NSTimeInterval > ) > > Any further discussion along these lines would probably be better > taken to a mac development list such as cocoa-dev. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users