0

I want the formatted date response from Cassandra Python Driver Model. Currently my response is

{
  "fname": "First",
  "lname": "Last",
  "data_id": "a1c054e2-b393-11ed-9de9-001a7dda7115",
  "data_date": {
    "days_from_epoch": 19296
  }
}

But, I want the output like

{
  "fname": "First",
  "lname": "Last",
  "data_id": "a1c054e2-b393-11ed-9de9-001a7dda7115",
  "data_date": "2022-10-31"
}

By using the following I am getting the desired value but using this I need to loop on the data we are getting. I want the model should return the same output.

new_date = datetime.datetime(1970,1,1,0,0) + datetime.timedelta(19296)

print(new_date)

output : 2022-10-31
Erick Ramirez
  • 13,964
  • 1
  • 18
  • 23

0 Answers0