3280.cpp (308B)
1 class Solution { 2 public: 3 string convertDateToBinary(const string &date) const { 4 const auto year = stoi(date.substr(0, 4)); 5 const auto month = stoi(date.substr(5, 2)); 6 const auto day = stoi(date.substr(8, 2)); 7 8 return format("{:b}-{:b}-{:b}", year, month, day); 9 } 10 };