不同格式的strftime问题

时间:2018-01-13 15:17:02

标签: c++ date time strftime time-t

string Account::dateCreated(){
    time_t rawtime;
    struct tm * timeinfo;
    char buffer [80];

    time (&rawtime);
    timeinfo = localtime (&rawtime);

        strftime (buffer,80,"%a %b %d %T %Z %Y",timeinfo);
        return buffer;
}

由于某种原因,这不会返回任何内容,但是当我稍微更改它时,它会起作用:

string Account::dateCreated(){
    time_t rawtime;
    struct tm * timeinfo;
    char buffer [80];

    time (&rawtime);
    timeinfo = localtime (&rawtime);

    strftime (buffer,80,"%A %d/%m/%Y",timeinfo);
    return buffer;
}

之前的输出是:没有

现在的输出是:星期六13/01/2018

0 个答案:

没有答案