I am getting date string from API now I want show that date is between from date to To date in iOS swift

Viewed 36

This is API Model:

func transactionsListAPI(){
       let params:[String:Any] = ["user_id":DefaultValues.value(forKey: "USERID") as? Int ?? 0]
       WebService.shared.apiDataPostMethod(url:tranactionListUrl, parameters:params) { (response, error) in
           if error == nil{
               self.transModel = Mapper<MytaransactionsModel>().map(JSONObject: response)
               
               if self.transModel.success == true{
                   
                    if let data = self.transModel.data , data.count > 0{
                       self.transactionsListdata = data
                    
                       self.transactionTable.reloadData()
                   }
                   
               } else if self.transModel.success == false{
               }
           }else{
               self.showMessages(messages: error?.localizedDescription ?? "")
           }
       }
   }

This is my Tableview data :

 let fullName : String = transactionsListdata?[indexPath.row].createdAt ?? ""
    let fullNameArr : [String] = fullName.components(separatedBy: " ")
    
    // And then to access the individual words:
    
    let firstName : String = fullNameArr[0]
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "dd-MM-yyyy"
    let s = dateFormatter.date(from: firstName)
    let dateString = dateFormatter.string(from: s ?? Date())

    cell.dateLbl.text = dateString//transactionsListdata?[indexPath.row].createdAt ?? ""

This is getting from API response : "created_at" = "11-03-2021 08:36:13 PM";

Now I am selecting from date is 09-03-2021 and to date is 13-03-2021

then how can show "created_at" in between of from date and to date in tableview list please help to me some one thank you in advance

0 Answers
Related