0
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;
}

For some reason this does not return anything but when I change this slightly it works:

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;
}

The output before was: nothing

The output now is: Saturday 13/01/2018

Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
Neil Shah
  • 33
  • 4

0 Answers0