Search code examples
iosswiftcore-data

Best practice to store milliseconds in CoreData


In my application our backend service sends me startedTime parameter as a milliseconds (sample value is 1649576635649). I need to store it in CoreData and I already tried to store in String and Integer64. There are also other options like NSNumber, Integer16, Integer32 However I am not sure which one is best?


Solution

  • Hi I would store it as Date in Core Data

    See

    Date to milliseconds and back to date in Swift

    for the conversion.