Search code examples
iosswiftdeserializationsendbird

Deserialize Sendbird message CreatedAt data


I am trying to get the dates of the message send date in String format from sendbird messages, but don't know how to deserialize the messages.

currently I am just getting a mess of numbers like follows:

1506267806611

I currently store the serialized date in the variable below, but can't figure out what's needed to deserialize in swift 3

var msgDate = userMessage.createdAt

Solution

  • That's a timestamp. You can convert it to a date using

    Date(timeIntervalSince1970: msgDate)