I am trying to update a UILabel with a firebase timestamp. I know that the timestamp will first need converting and formatting but I don't know the right method to use to do it all.
So, in my NewsFeedVC, I have the following:
DataService.ds.REF_POSTS.queryOrdered(byChild: "postedDate").observe(.value) { (snapshot) in
self.posts = []
if let snapshot = snapshot.children.allObjects as? [DataSnapshot] {
for snap in snapshot {
if let postDict = snap.value as? Dictionary<String, AnyObject> {
let id = snap.key
let post = Post(postId: id, postData: postDict)
self.posts.append(post)
}
}
}
self.tableView.reloadData()
}
What code do I need to implement to get the timestamp, convert it, format it (dd-mm-yy) and pass it to my NewsFeedCell so I can update the UILabel?
Thanks,
Scott