I have a coredata model backed by a sqllite db. I want to populate the db with some initial data.
I have been using Python to do this so far and it has been working well. The only bit that isn't working is inserting dates. I understand coredata stores dates in epoch format so I am currently inserting them via Python like this:
time.mktime(datetime(2012, 7, 1, 12, 30, 30).timetuple())
However, this doesn't give me the correct date when the data is loaded via coredata. Any ideas on how to format the date so it is read in correctly via coredata?
*NOTE: I realise that most people recommend doing this via a small app that uses the same model rather than using a Python script, but I find the Python syntax more concise for constructing and inserting lots of objects.
E.g. I can call methods that insert data like this:
insertData(con, 1, 1, 'Data 1', 'Description')
vs Objective-C with its long-winded method calls:
[self insertdata withCon:con id: 1 i2:1 val:@"Data 1", Desc:@"Description"];