time_t to string back and forth in windows
问题 I have 2 functions. First one converts time_t to string. Second one string to time_t. I just have the date that needs to be converted and restored back as string. The functions are void split(const string &s, char delim, vector<string>& elems) { stringstream ss(s); string item; while(getline(ss, item, delim)) { elems.push_back(item);} return; } time_t getDateInTimeTfromHyphenSplitString(string s) { struct tm tmvar = {0}; vector<string> tim; split(s.c_str(),'-',tim); tmvar.tm_year = atoi(tim[2