|
-
January 19th, 2005, 12:44 PM
#1
Obtain System Time
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.
-
January 19th, 2005, 12:47 PM
#2
Re: Obtain System Time
Here is how I done it
Code:
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 );
Regards
-
January 19th, 2005, 12:49 PM
#3
Re: Obtain System Time
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 );
-
January 19th, 2005, 12:50 PM
#4
Re: Obtain System Time
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
Best Regards,
--Zim If you find this post useful, please rate it.
_________________________________
"Have you the brain worms?!?!?"
-
January 19th, 2005, 12:52 PM
#5
Re: Obtain System Time
 Originally Posted by fitcher
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.
void GetSystemTime(
LPSYSTEMTIME lpSystemTime
);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|