-
September 9th, 2002, 12:34 AM
#1
Some Problem with CTime (MFC)
Hi all,
i'm trying to get date and time using CTime class object.
like
int day;
CTime tm;
day = tm.GetDay();
but it's giving some assertion failuer error. am i doing any mistake? please tell me what was wrong with my code? n suggest me how to get date and time using VC++ MFC.
Thanks in advance
-srujan
-
September 9th, 2002, 12:37 AM
#2
Ctime curtime =CTime::GetCurrentTime();
m_sTime.Format("%d:%d:%d",curTime.GetHour(),curTime.GetMinute(),curTime.GetSecond());
try this
-
September 9th, 2002, 12:40 AM
#3
Hi !
To get the current time :
1) Allocate a CTime object, as follows:
CTime theTime;
Note : Uninitialized CTime objects are not initialized to a valid time
2) Call the CTime::GetCurrentTime function to get the current time from the operating system.
theTime = CTime::GetCurrentTime();
And then you can use GetDay();
int iDay = theTime.GetDay();
Hope it's help !
comiv
-
September 9th, 2002, 01:54 AM
#4
HI manikanna & comiv,
thanks for your help. now i'm getting my curent time and date with your code help.
Thank you very much
regards
-srujan
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
|