char* Form1::get_date(void) { time_t now = time(NULL); tm * ptm = localtime(&now); char buffer[32]; // Format: Mo, 15.06.2009 20:20:00 strftime(buffer, 32, "%a, %d.%m.%Y %H:%M:%S", ptm); return buffer; } Output: žo 02.09.2013 10:14é€ Error char* Form1::get_date(void) { char date[80]; time_t t = time(0); struct tm *tm; tm = gmtime(&t); // Format: 20:00 strftime(date, sizeof(date), "%M:%S", tm); return date; } Output: 17:0Àî" Error
void Form1::updateConsole(System::String^ text) { System::String^ consoleOutput; consoleOutput = gcnew String(get_date()); rtbConsole->Text += consoleOutput; rtbConsole->Text += " " + text; rtbConsole->Text += Environment::NewLine; }
void Form1::get_TimeStamp(char buffer[]) { time_t now = time(NULL); tm * ptm = localtime(&now); //char buffer[32]; // Format: Mo, 15.06.2009 20:20:00 strftime(buffer, MAX_DATE, "[%H:%M:%S]", ptm); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)