I'm using WinXP. Can anyone please tell me how to obtain system time and then display it in an edit box?
Thanks for helping.
Printable View
I'm using WinXP. Can anyone please tell me how to obtain system time and then display it in an edit box?
Thanks for helping.
Here is how I done it
RegardsCode:CString string;
struct tm *local=localtime(&t);;
string.Format( _T("%02d/%02d/%04d %02d:%02d:%02d"),
local->tm_mday,
local->tm_mon+1,
local->tm_year+1900,
local->tm_hour,
local->tm_min,
local->tm_sec );
I miss something
Code:time_t t = time(NULL);
CString string;
struct tm *local=localtime(&t);;
string.Format( _T("%02d/%02d/%04d %02d:%02d:%02d"),
local->tm_mday,
local->tm_mon+1,
local->tm_year+1900,
local->tm_hour,
local->tm_min,
local->tm_sec );
use COleDateTime::GetCurrentTime()
and you can Format it to display however you wish, check the msdn for the options
create a control variable for the text box and dump the time as a string into it using SetWindowText
void GetSystemTime(Quote:
Originally Posted by fitcher
LPSYSTEMTIME lpSystemTime
);