I'm trying to get the local time from window using C++.
I tired using systemtime and systemdate, but it seems they were off. I think it's using GMT-0 if i'm not mistaken.
I manage to get the local date using #include <ctime>
however i'm not sure where to begin to look for getting the local time. Could someone give me some advice? ThanksCode:#include <iostream> #include <ctime> using namespace std ; int main( ) { char buffer[BUFSIZ] = { '\0' } ; time_t now = time( &now ) ; struct tm* local_time = new tm( ) ; local_time = localtime( &now ) ; strftime( buffer, BUFSIZ, "%d / %m / %Y", local_time ) ; system("PAUSE\n"); cout << buffer ; cout << "\n"; system("PAUSE"); }



LinkBack URL
About LinkBacks



