|
Hi All.
1) I am getting Current time in the format "hhmmss".
2) I read a parameter minute for example 5 minutes(i.e Duration)..
Now i want to add this two time.
suppose first is current time
second is duration
I want add this(current Time + Duration) and get the result....
can u plz help me
thank you in advance...
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
If you're using MFC , then CTime and CTimeSpan will do the magic. See [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi..
I am using COleDateTime....
I am getting the current time in format hhmmss..
I am a reading a parameter which has only minutes Example 10 min..
I have to add 10 min to current time i.e hhmmss..
Note) The parameter in code csDuration is in minutes
here is my code
////////////////////////////////////////////////////////////////
COleDateTime StartTime;
StartTime = COleDateTime::GetCurrentTime();
CString StTime;
StTime.Format("%02d:%02d:%02d",StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond());
COleDateTimeSpan ts1(Sttime);
COleDateTimeSpan ts2(csDuration);
COleDateTimeSpan ts3 = ts1 + ts2;
////////////////////////////////////////////////////////////////////
plz help me
thank you
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
What about
COleDateTime StartTime;
COleDateTime EndTime;
StartTime = COleDateTime::GetCurrentTime();
COleDateTimeSpan ts(0,0,csDuration,0);
EndTime += ts;
EndTime = StartTime + ts;
?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
modified on Monday, April 21, 2008 8:44 AM
|
|
|
|
|
Hi
I tried ur code..but its showing dedug error....
by the way ur only calling CurrentTime..where u r geeting the format of time...
i tried this it also did not work
code is.
/////////////////////////////////////////////////////////////
COleDateTime StartTime;
COleDateTime EndTime;
CString StTime;
StartTime = COleDateTime::GetCurrentTime();
StTime.Format("%d:%d:%d",StartTime.GetHour(),StartTime.GetMinute(),StartTime.GetSecond());
COleDateTimeSpan ts(0,0,csDuration,0);
EndTime += ts;
printf("Date is %s",EndTime);
getchar();
/////////////////////////////////////////////////////////////////
here were ur adding the current time to csDuration parameter...
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
try:
COleDateTime StartTime;
COleDateTime EndTime;
CString EtTime;
StartTime = COleDateTime::GetCurrentTime();
COleDateTimeSpan ts(0,0,csDuration,0);
EndTime = StartTime + ts;
EtTime.Format("%d:%d:%d",EndTime.GetHour(),EndTime.GetMinute(),EndTime.GetSecond());
printf("Date is %s\n",EtTime);
getchar();
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi..
Thank you very much its working
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
Hi..
How to convert _TCHAR * to int......
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
Use _ttoi() .
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi..
I tried it before only..its not working..
////////////////////////////////////////
_TCHAR *csDuration;
int cDuration;
cDuration = _ttoi(csDuration);
////////////////////////////////
Its not working
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: I tried it before only..its not working..
Is this supposed to be your version of descriptive?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
hi..
I did not got u...
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: I did not got u...
Nor I you.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Is this supposed to be your version of descriptive?
You would understand if you read the post in UTC time[^]
led mike
|
|
|
|
|
I don't follow, Mike. What does that have to do with atoi() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: What does that have to do with atoi()?
Nothing Dave, I thought you would get a laugh out of it, guess I was wrong.
led mike
|
|
|
|
|
sharanu wrote: _TCHAR *csDuration;
int cDuration;
cDuration = _ttoi(csDuration);
If you initialize csDuration with some acceptable string, such as _T("24") , for instance, then, maybe, it would work.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi...
I have two dates..
1)First I am getting from mail i.e in the format mm/dd/yyyy hh:mm:ss (example 4/2/2008 2:56:50 pm)
2)Second I am passing the parameter i.e in the format dd/mm/yyyy.
(example 2/4/2008)
Now i want to compare the two dates which is greater in it...
I am not getting which class to use...
plz help me..
thank you...in advance
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
With COleDateTime, you have to use the ParseDateTime method, specifying correctly the lcid parameter.
For instance (I assume your date formats are compatible, respectively with US and Italian lcid s, I don't know if it is correct)
COleDateTime firstDate, secondDate;
firstDate.ParseDateTime(_T("4/2/2008 2:56:50 pm"), 0, MAKELCID(MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US),SORT_DEFAULT));
secondDate.ParseDateTime(_T("2/4/2008"), 0, MAKELCID(MAKELANGID(LANG_ITALIAN, SUBLANG_ITALIAN),SORT_DEFAULT));
if ( firstDate > secondDate)
{
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi..
Actually i have 3 dates..
1) ST_DATE
2) END_DATE
3) MailDate
ST_DATE and END_DATE i read from config file i.e in the format mm/dd/yyyy..
Example
ST_DATE=4/1/2008.
END_DATE=4/2/2008.
MailDate i read from mails....i.e in the format mm/dd/yyyy hh:mm:ss pm
Example
MailDate= 4/2/2008 2:56:50 pm...
Now i want to display the mails which come from ST_DATE and END_DATE..
I need to check
if(maildate >= ST_DATE) && (mailDate <= END_DATE)....
I think you got me....
thank you
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
And what is the problem (I mean your sign asserts you're experienced)?
for instance
COleDateTime startDate, endDate, mailDate;
DWORD lcidUS = MAKELCID( MAKELANGID( LANG_ENGLISH,SUBLANG_ENGLISH_US), SORT_DEFAULT);
DWORD lcidIt = MAKELCID( MAKELANGID( LANG_ITALIAN, SUBLANG_ITALIAN), SORT_DEFAULT);
startDate.ParseDateTime(_T("1/4/2008"), 0, lcidIt);
endDate.ParseDateTime(_T("2/4/2008"), 0, lcidIt);
mailDate.ParseDateTime(_T("4/2/2008 2:56:50 pm"), 0, lcidUS);
if ( mailDate >= startDate && mailDate < endDate)
{
}
else
{
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi...
Its not comparing properly....
I have the mails of date 4/2/2008.....
when i give the ST_DATE=4/1/2008.
END_DATE=4/2/2008.
It is showing the message no mails found within that date...
comparision problem...
thank you
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
You're wrong. Comparison it's working well. If you need all the emails of April 2th (for instance) then you have to do something similar to:
startDate.ParseDateTime(_T("2/4/2008"), 0, lcidIt);
endDate.ParseDateTime(_T("3/4/2008"), 0, lcidIt);
mailDate.ParseDateTime(_T("4/2/2008 2:56:50 pm"), 0, lcidUS);
if ( mailDate >= startDate && mailDate < endDate)
{
}
else
{
}
Since startDate actually represent "02/04/2008 00:00:00" and endDate is "03/04/2008 00:00:00".
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi..
If i compare only once
i.e if(cMailDate < startDate)
its working properly..
but i compare
if(cMailDate <= startDate && cMailDate > endDate)
its not working..
I feel somewhere that in mailDate format is mmddyyyy hh:mm:ss
wheteher time is making problem for comparision.
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: if(cMailDate <= startDate && cMailDate > endDate)
Of course. it should be
if(cMailDate <big>>=</big> startDate && cMailDate <big>< </big>endDate)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|