void ShowPost() { // ------------------------ THIS IS FOR TIME ----------------------------------- DateTime postedDate = userPost.CreatedAt; DateTime dateNow = DateTime.Now; int days = Convert.ToInt32((dateNow - postedDate).TotalDays); int hours = Convert.ToInt32((dateNow - postedDate).TotalHours); int minutes = Convert.ToInt32((dateNow - postedDate).TotalMinutes); if (days == 0) { if (hours > 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + hours + " hours ago"; } else if (hours == 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + hours + " hour ago"; } else { if (minutes > 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + minutes + " minutes ago"; } else if (minutes == 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + minutes + " minute ago"; } else { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + " just now"; } } } else { if (days > 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + " days ago"; } else if (days == 1) { lblDate.Text = userPost.Category + " • Posted by " + user.Username + " " + " day ago"; } } // ----------------------- CONTENT ------------------------------------- // IMAGE if (userPost.Image != null) { postImage.ImageUrl = "data:Image/png;base64," + userPost.Image; postImage.Visible = true; } else { postImage.Visible = false; postImage.CssClass = "noImage"; } // CONTENT TEXT lblContentMessage.Text = userPost.Content.ToString(); // Comment - CHANGE THE POSTID int commentCount = CommentRepo.commentCount(postID); if (commentCount > 1) { lblComment.Text = commentCount.ToString() + " Comments"; } else { lblComment.Text = commentCount.ToString(); } }