mercredi 13 juillet 2016

convert the string to specific datetime format with strptime in c++


        I have a string in format Date Time 20160524T154628
        Now want the values in terms::hr :: 15,mm:: 46,ss :: 28,month:: 05,year:: 2016,day:: 24

 string convertstring(*str1)
    {
         struct tm t;
          strptime(sr1, "%Y%m%dT%H%M%S", &t);
        char buffer[256];
          strftime(buffer, sizeof(buffer), "%F %T", &t);
    string str2(buffer);
    return str2;

    }

Aucun commentaire:

Enregistrer un commentaire