COleDateTime Comparison

How do I compare 2 COleDateTime objects?  Do I have to format them as
CStrings and then CompareNoCase() or is there a better way?


0
w_gower (280)
9/27/2003 3:30:44 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
944 Views

Similar Articles

[PageSpeed] 55

Sometimes the date field may be empty, how do I allow for the in the
comparison.  I am getting an error because of comparing a date field with an
empty field.

"Scott McPhillips [MVP]" <scottmcp@mvps.org> wrote in message
news:OFI68ARhDHA.2192@TK2MSFTNGP09.phx.gbl...
> William Gower wrote:
>
> > How do I compare 2 COleDateTime objects?  Do I have to format them as
> > CStrings and then CompareNoCase() or is there a better way?
> >
> >
>
> Have you tried if (time1 <= time2) ?
>
> COleDateTime overloads operator <=, == etc.
>
> -- 
> Scott McPhillips [VC++ MVP]
>


0
w_gower (280)
9/27/2003 4:35:56 PM
William Gower wrote:

> How do I compare 2 COleDateTime objects?  Do I have to format them as
> CStrings and then CompareNoCase() or is there a better way?
> 
> 

Have you tried if (time1 <= time2) ?

COleDateTime overloads operator <=, == etc.

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp (342)
9/27/2003 4:58:17 PM
Hi,

You can try using COleDateTime::SetStatus() and 
COleDateTime::GetStatus() to avoid getting an error due 
to an empty field.

Geo

>-----Original Message-----
>Sometimes the date field may be empty, how do I allow 
for the in the
>comparison.  I am getting an error because of comparing 
a date field with an
>empty field.
>
>"Scott McPhillips [MVP]" <scottmcp@mvps.org> wrote in 
message
>news:OFI68ARhDHA.2192@TK2MSFTNGP09.phx.gbl...
>> William Gower wrote:
>>
>> > How do I compare 2 COleDateTime objects?  Do I have 
to format them as
>> > CStrings and then CompareNoCase() or is there a 
better way?
>> >
>> >
>>
>> Have you tried if (time1 <= time2) ?
>>
>> COleDateTime overloads operator <=, == etc.
>>
>> -- 
>> Scott McPhillips [VC++ MVP]
>>
>
>
>.
>
0
ckarakiro (63)
9/28/2003 1:15:37 PM
Reply:

Similar Artilces:

Column comparison
I am trying to compare 2 columns of numbers so that I can identify and delete numbers no longer required. Can anyone help me find a formula for this please? Many thanks DT Chip Pearson has lots of techniques for working with duplicates: http://www.cpearson.com/excel/Duplicates.aspx =isnumber(match(a1,sheet2!a:a,0)) will return True if the value in A1 (of sheet1) matches any value in column A of sheet2. Dave T wrote: > > I am trying to compare 2 columns of numbers so that I can identify and > delete numbers no longer required. Can anyone help me find a formula for > t...

COleDateTime Confusion
Using the code COleDateTime Date1( 2003 , 8 , 31 , 0 , 0 , 0 ); COleDateTime Date2( 2003 , 8 , 1 , 0 , 0 , 0 ); COleDateTimeSpan DateDifference = Date1 - Date2; sprintf( aux , "From %s to %s is %s days" , (LPCTSTR) Date2.Format( "%B %d %Y" ) , (LPCTSTR) Date1.Format( "%B %d %Y" ) , (LPCTSTR) DateDifference.Format( "%d" ) ); pdc->TextOut( 100 , currow - 2*rowHeight , aux ); the program displays that the difference is 29 days. My quick calculation usi...

Date comparison in IIF statement in a query
I have a form with a control containing a date. This date is used in a query as part of a IIF statement included in the criteria row of the query: IIf(IsNull([Forms]![RiderMatchAnalysis]![Start Date]),[Meeting]![MeetingDate],>[Forms]![RiderMatchAnalysis]![Start Date]) The syntax must be wrong in some way as it does not return any records. Any help would be appreciated. Thanks. LL wrote: >I have a form with a control containing a date. This date is used in a query >as part of a IIF statement included in the criteria row of the query: > >IIf(IsNull([Forms]...

From CDateTimeCtrl to COleDateTime, plz help me
Hey, I have a question about CDateTimeCtrl, I have a form-view with a CDateTimeCtrl control where the user can select a date (long format). Now i want to store the date the user selected in a COleDateTime object, how do i get the date from the CDateTimeCtrl into the COleDateTime variable? cheers, Paul "Paul Schouten" <vincent_schouten@yahoo.com> schrieb im Newsbeitrag news:42e21af6$0$97483$e4fe514c@news.xs4all.nl... > Hey, > > I have a question about CDateTimeCtrl, I have a form-view with a > CDateTimeCtrl control where the user can select a date (long fo...

COleDateTime ???
I have a form with 3 controls on it. They are a Combo box, a date picker and a submit button. I added control variables for the combo box and the date picker and add a function for the submit button. The control variables are c_select, c_date. When the submit button is pressed I want to transfer the info in the controls to the document. So in the function I added code // local variables to make sure I am getting what I want int select; COleDateTime date; // transfer data to locals select = c_select.getcursel(); c_date ?????????????????????????????????????????????? now how can I get th...

List Comparison
I would be most grateful if someone could help. I have two lists residing in Column A and Column B respectively. Both lists contain 4 figure numbers. Column A contains the 'complete list' and Column B only contains 'some' of the entries from Column A. I would like Column A compared to Column B and any numbers that are not in Column B but are in Column A put in Column C. Many thanks in advance. hi, in column C enter and then copy formula down =IF(ISERROR(MATCH($A$1:$A$6,$B$1:$B$6,0)),$A$1:$A$6,"") Change range to fit your needs "SiH23&qu...

COleDateTime Comparison
How do I compare 2 COleDateTime objects? Do I have to format them as CStrings and then CompareNoCase() or is there a better way? Sometimes the date field may be empty, how do I allow for the in the comparison. I am getting an error because of comparing a date field with an empty field. "Scott McPhillips [MVP]" <scottmcp@mvps.org> wrote in message news:OFI68ARhDHA.2192@TK2MSFTNGP09.phx.gbl... > William Gower wrote: > > > How do I compare 2 COleDateTime objects? Do I have to format them as > > CStrings and then CompareNoCase() or is there a better way? &g...

COleDateTime Issue
Hi All, MS DTP Control is implemented such that, if a) you type in 2 digit year, it takes it as 20XX where XX is the year you entered is <=29. b) you type in 2 digit year, it takes it as 19XX where XX is the year you entered is >=30. As soon as user types a 2 digit year in MS DTp control, it automatically converts it to 19XX or 20XX depending upon what user wrote. So, even if I do an UpdateData() and get the value to a contrl variable .. I get the 4 digit value and not a 2 digit ... and there is no way for me to know thatuser typed a 2digit year(which MS control automatically u...

Need help on comparison of dates in different format.
Hi I have question pertaining comparison of dates in different format :- eg. 20 April , 2004 [Cell A1] 20-4-04 [Cell A2] I was using if not function. ie. if(A1=A2, True, False). The result always shown as False. Pls help as to how could I do correct way solving this problem. ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Business Software Galore! Free Excel Forum http://www.ozgrid.com/forum *** Hi are both cells real date values or are they stored as 'Text'?. Check both values with =ISNUMBER(A1) =ISNUMBER(A2) th...

CD Interest Rates and Lengths Comparisons
I'd like to do some laddering with CD's, and wonder if there's a template out there that is set up to show the return I'd get with different rates and for 3, 6 and 12 month periods. Montana Trainer wrote: > I'd like to do some laddering with CD's, and wonder if there's > a template out there that is set up to show the return I'd get > with different rates and for 3, 6 and 12 month periods. I do not know about an Excel template, but I did not find a calculator at bankrate.com that might serve your purpose. Go to http://www.bankrate.com/brm/savings-a...

Column comparison
I am trying to compare 2 columns of numbers so that I can identify and delete numbers no longer required. Can anyone help me find a formula for this please? Many thanks DT Hi Dave, Need more information like a sample of the existing data plus a sample of what you want left. Maybe an explanation of the criteria for what needs to be deleted. -- Regards, OssieMac "Dave T" wrote: > I am trying to compare 2 columns of numbers so that I can identify and > delete numbers no longer required. Can anyone help me find a formula for > this please? > > Many than...

Text File Comparison
Hello: I have 2 separate text file each containing a bunch of IP addresses. The first text file (TextIP-1.txt) contains 100 IP addresses; list 1 below the other. The second text file (TextIP-2.txt) contains 56 IP addresses; listed 1 below the other. I am looking to compare the content of these 2 text files & identify those overlapping IP addresses that exist in BOTH of these text files. Maybe the results can be printed to a third text file. Any help appreciated. * Is there a simple Excel function that can achieve this objective ? Thanks in advance. Jo. <JoJo> w...

COleDateTime
I have a compare routine that compares 2 COleDateTime field members. The problem is that one of them or both of them might be empty. If(pBear1->m_BirthDate > pBear2->m_BirthDate) return 1 else return -1 It doesn't seem to like this though if one of them or both of them are blank. This depends on the requirements of your app. You should also take into consideration the status of COleDateTime via GetStatus() -- in debug mode, the compare will assert if the date/time is not valid. "William Gower" <w_gower@hotmail.com> wrote in message news:egdY5w2...

COleDateTime Question
Hi. I have an internal API that expects a time/date as a DWORD, but I've read the time from a data file as a COleDateTime (actually as a double to start with). What is the most efficient way to convert between the time as a double to the time as a DWORD? I have this code working, but it seems a little long-winded: double dTime = 37064.7269907; // Actually read from file, but simplified for here... COleDateTime oleTime(dTime); SYSTEMTIME sysTime; oleTime.GetAsSystemTime(sysTime); CTime timeTemp(sysTime.wYear, sysTime.wMonth, sysTime.wDay, sysTime.wHour, sysTime.wMinute, sysTi...

Utility That Does Cell-By-Cell Comparison Of Two Spreadsheets?
.... and creates a report of differences... Anybody know of such a thing? Don't need anything sophisticated - just a simple-minded cell-by-cell comparison of data values. -- PeteCresswell Per (PeteCresswell): >Anybody know of such a thing? Oops! Ill-considered post. Just Googled it (duhhhh...) and found a number of relevant hits. -- PeteCresswell Pete, Since you asked... xlCompanion here... http://www.realezsites.com/bus/primitivesoftware Jim Cone San Francisco, USA "(PeteCresswell)" <x@y.Invalid> wrote in message news:pnm1u19vu11tn6rt5mmite6gcglm3r3e8r@...

How to convert COleDateTime(or DATE) to tm structure?
Hi, I need to format DATE into localized string. In our code base there's such function but it needs a tm as input, so I need to convert DATE into tm to use this function. Is there a way to do that? Or if I can go around? Thanks, Meal. Does COleDateTime::Format() with the LOCALE_NOUSEROVERRIDE flag do what you need? Mark -- Mark Salsbery Microsoft MVP - Visual C++ "Meal" <meedeex@gmail.com> wrote in message news:1193674366.295581.83940@e34g2000pro.googlegroups.com... > Hi, > I need to format DATE into localized string. In our code base > there...

Price Comparison Macro
I have a workbook with four sheets in it. On each of the first three sheets, located in cells F33:F52 and N33:N52 are unit prices. The fourth sheet is blank. I would like to know if (and how) a macro can be created that would look at the unit price in cell F33 of Sheet 1, then compare it to the unit price in F33 of Sheet 2 and F33 of Sheet three, decide which is the lowest, and place it in the cell F33 of sheet 4. Then, look at the next cell (F34) and do the same thing, etc. I am an absolute novie with VBA, but really need this. It would make my life so much easier. Thanks. Gosh...

COleDateTime::Format
Hi all Recently we start migrating from VC 6.0 to VS 2005 We have the following problem: for one reason or another we save in the DB dates that are represented as 0 (COleDateTime::m_dt is zero). later on when we try to print this date using this COleDateTime::Format(_T("%Y.%m.%d %H:%M")) I get an error and the process is terminated. I check the code of COleDateTime::Format and I saw this: tmTemp.tm_year = ud.st.wYear - 1900; which result in negative tm_year (zero represent date that is in year < 1900). which is incorrect param for _tcsftime (_tcsftime is used from COleDateT...

multiple comparison between means #2
Can more than two means be compared using Excel/ If not, is there any free software available for this? Please relply. Maybe something like this would help......... =IF(AND(A1=A2,A1=A3,A1=A4),"ALL FOUR ARE THE SAME","DIFFERENT") hth Vaya con Dios, CABGx3 "Siddhartha" wrote: > Can more than two means be compared using Excel/ If not, is there any free > software available for this? Please relply. ...

Trouble with If comparison
An If statement in column AA asks whether entry in col B is >= "L2" and gets a 'FALSE" result even though the entry in col B is "L12"? What am I doing wrong? Thanks. In what way is L12 greater than L2? -- Regards, Peo Sjoblom "SedonaBob" <SedonaBob@discussions.microsoft.com> wrote in message news:68A43B51-2E1F-4CBB-816A-87937001EB1A@microsoft.com... > An If statement in column AA asks whether entry in col B is >= "L2" and > gets > a 'FALSE" result even though the entry in col B is "L12"? W...

XPath problem with dateTime strings comparison
Hello, I've got an XML file saved from DataSet. One table has datetime column (datatype - xs:dateTime). XML file fragment for example: <Root> <Element>2004-03-15T00:00:00.0000000+01:00</Element> <Element>2004-03-16T00:00:00.0000000+01:00</Element> <Element>2004-03-17T00:00:00.0000000+01:00</Element> <Element>2004-03-18T00:00:00.0000000+01:00</Element> </Root> I'm trying to get MyXmlNodeList using MyXmlDataDocument.DocumentElement.SelectNodes(MyXPathString) method, where MyXPathString, for example, should loo...

COleDateTime Format
How can I format a COleDateTime so it appears in Long Format but without the seconds (this needs to run in the current local) For example "%#c" give me something like Friday February 24th 2003, 10:34:00 and what I want is Friday February 24th 2003, 10:34 Any ideas please? -- Michael Tissington http://www.tabtag.com http://www.oaklodge.com Try the following COleDateTime dtCurrentDate ( COleDateTime::GetCurrentTime() ); AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y %H:%M") ) ); -- Cheers Check Abdoul [VC++ MVP] -----------------------...

row comparison
Hi, I have a spreadsheet that looks similar to the below: row 1: 1 aaa bbb ccc row2 : 1 aaa bbb ddd row3 : 2 eee fff ggg row4 : 2 eee zzz yyy .. .. .. What I want is a macro to run through all the rows and do a row-to-row comparison between rows with an identical id (first column). Differences should be highlighted by changing the cell colour to red. For example, with the above, a comparison of the first two rows should highlight the cells 'ccc' and 'ddd'. A comparison of the next two rows will highlight 'fff', 'zzz', 'ggg' and 'yyy'. Could ...

Where is the loan comparison tool in Money 2006
In my previous versions of money (2004 for sure, i thought 2005 as well), there was a nice tool that would allow me to compare 2 loans in order to determine the best option. I can't find that tool in 2006. Has it been removed? If not, can someone help me find it? Thanks Troy You know, darned if I can find it. There are lots of these tools in the internet, though -- do you need a referral? -- "Troy Ankersen" <tankers@hotmail.com> wrote in message news:OIvArBKiFHA.3288@TK2MSFTNGP09.phx.gbl... > In my previous versions of money (2004 for sure, i thought 200...

Excel field comparisons
I would like to compare a range of data against another range of data: 1) The first range contains numerous names 2) The second range containts select names from #1 3) I want to pull out the matching names from #1 based on the names listed in #2. Is this possible with the IF function or another function? Ultimately, I want to be able to pull all of the matched information into a separate spreadsheet and then export it into an Access database for further analysis. Thought, comments, words of wisdom? CG Take a look at http://cpearson.com/excel/duplicat.htm In article <a1c801c4...