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 using P&P says that the difference should be 30 days.

    What's up here?

            TIA
                Norm


0
ndrez (136)
8/1/2003 5:33:54 PM
vc.mfc 33608 articles. 0 followers. Follow

0 Replies
567 Views

Similar Articles

[PageSpeed] 53

Reply:

Similar Artilces:

Royally Confused!!
Hello all... here is my situation: On Sheet2 of my workbook I have a set of data that starts at B3:B9. Next to column "B" I have column "C-F" with data that corresponds to each row of "B". For example: B2=Stock C-F2=price,PE, etc... I have highlighted the stocks listed in column "B" and defined a name for them. On Sheet1 I have gone through the validation and set up the pull down menu where I can select the stock from Sheet2. But my question is how can I set it up so that when I choose the a stock from the pull down list in the adjacent columns it r...

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...

Chart confusion
Hey, I'm creating this chart that will hold my blood sugar level info. On the screen is a graph that shows the levels. underneath(white part) I want it to list either Breakfast, Lunch, Supper, or Night for each point. I have the meal time listed in the same row of the ajoining blood sugar; and they are all listed in column F. Also, the chart is set as a Series, is this the best idea? Thanks for any help! Gordy ...

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...

quite confused about Crystal report version
Hi, there We have a CRM 1.2 running in our company. We want to do some custumiztion on the reports using Crystal Report. I just surf the Crystal Report website, they got v9 and v10 sold online. And also got Advanced, Developer, Professional Edition w/ user license or w/o user licene. Can anybody tell me what Version and what Edition shall I need to meet my requirement? Shall I buy the user license for every CRM user? As I know we already got CR run-time license when purchasing the CRM system. Thank you There are a couple of options available to you Microsoft CRM v1.2 ships with a speci...

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...

[ANN] AutoUpdate to 12.0.1 Confusion
The update for Office to 12.0.1 is not available through the AutoUpdate at this time. Currently, the only place to get it is from MacTopia. Continue reading AutoUpdate to 12.0.1 Confusion (The Entourage Help Blog) <http://blog.entourage.mvps.org/2008/03/autoupdate_to_1201_confusion.html> <http://tinyurl.com/23mnra> -- Diane, Microsoft Mac MVP (MVPs are not Microsoft Employees) Entourage Help Page <http://www.entourage.mvps.org/> Entourage Help Blog <http://blog.entourage.mvps.org/> ...

product key confusion
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I recently purchased Student/Home Office for Mac 2008 from the Apple website for my Macbook. I'm having issues installing it. I'm prompted for the 25 digit product key before installation, yet none of the groups of numbers on the authenticity sticker add up to 25. One set is 21, another is 14 ( 22, if you combine the next closest group). What's more is that the installation program tells me I can find the numbers in the installation guide leaflet, well there's nothing of the sort to be found. Can anyone l...

Im confused! Can anyone "un"-confuse me?
Im sorry this post is so long. I'm trying to include as much info as possible so you can tell whats going on. Here's the scenario: I have a workbook with two tabs (Main & Data). The main sheet is where the user will enter data and the data sheet is where the code will dump the data. There is a combo box on the Main sheet from which the user will select the current date. Now when the user the selects the date and then enters the data on the page, the user will then click a button (called Save Data) on the main page at which point the data will be transfered to the Data sheet. The...

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...

workbook confusion
When I attempt to close a particular Excel file I sometimes get asked if I want to save the changes of some completely different file. It seems to me that Excel is merging two separate workbooks. If this observed behavior is correct, how can I change the behavior so that separate files are not merged? (Or is it me who is confused?) Thanks, E-Jo To clarify my confusion a little: My status bar shows that I have two xls files open. But there is only one shown open on the screen at any time. (I can switch between them by clicking on the status bar icon.) However, I would like to have them bo...

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...

confused???
I can't seem to figure out my windows email system. it asks for sever numbers and such??? if any one knows how to do it then let me know. Tisha S. wrote: > I can't seem to figure out my windows email system. it asks for sever > numbers and such??? if any one knows how to do it then let me know. ======================================= Maybe the following article will get you started: Windows Vista - Windows Mail: Setting up an account from start to finish http://tinyurl.com/yzf3t42 or..... http://windows.microsoft.com/en-US/windows-vista/Windows-Mail-sett...

Object Access to XSD created Class Confusing
Maybe newbie question but I'm stumped after much search of google. Last week created class using xsd.exe against xsd file from well nested xml that rendered in part: .... _ Public Class MacroflowCatalog '<remarks/> <System.Xml.Serialization.XmlElementAttribute("MacroFlow")> _ Public Items() As MacroflowCatalogMacroFlow End Class .... I was then able to reference MacroflowCatalog.Items(0).MacroFlow(0)...more depth from here, using Intellisense. In other words, everthing mapped neatly into nested arrays from the xml pattern. This week I'm using...

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...

bit confused !!
Hi, I'm quite new to COM implementation, and while making some applications I wrote following code and I got bit confused with the output the code is as follows... #include <iostream.h> #include <objbase.h> interface Ix : IUnknown { void show() { cout << a << endl; } int a; Ix():a(1) { cout << "In Ix" << endl;} }; interface Iy : IUnknown { Iy() {cout << "in Iy" << endl; } ~Iy() {cout << "out of Iy"; } }; extern const IID IID_Ix; extern const IID IID_Iy; class A : public Ix, public Iy { public...

confusion about multiple accounts at same bank
I have two Money files - 0ne for my personal accounts and one for my business. I use one bank for all of my accounts. Here's my problem: When I set up online banking for my personal accounts, it went out to the bank and rounded up all of the accounts I have there, including the business checking. It didn't seem to give me any choice about whether to "enable" each of the accounts for that particular Money file. It was all or nothing. Same thing happened when i set up the online banking for the buisiness files - I got all of the accounts, even when I didn't want al...

Confusing output from cells
:confused: I have made a spreadsheet that is gathering details from the user an then forming a string. However, in the 6th section of 8 it is causing problems. the formulas are all much the same. an example is shown below:- =if(b268="","",f88) Now, B268 is empty, so the "" criteria is met, but instead of bein nothing, the spreadsheet is counting this as a space, so that when th text is pasted into another program, extra spaces are added! However the Len of the above cell is 0, meaning it has no value whatsoever. Does anyone know anything about this? Than...

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...

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...

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] -----------------------...

COleDateTime and SetRange
I have a CDateTimeCtrl control and I need to set minimum and maximum date. How can I set maximum value of COleDateTime object? I need to set maximum value to tommorow date and minimum value to 2000-01-01. I have: COleDateTime low, today; today.GetCurrentTime(); low.SetDate(2000, 1, 1); //CDateTimeCtrl m_DateCTRL m_DateCTRL.SetRange(&low, &today); but now, I have 1899-12-31 as minimum value and 2000-1-1 as maximum value :( What is wrong? ArtuS GetCurrentTime doesn't work like you think it does Do this to get today's date. today = COleDateTime::GetCurrentTime(); Ali R. ...

passing COleDateTime with lparam in postmessage
I am trying to pass a time value to another application. Message that is sent: struct sendMsg{ COleDateTime curTime; CString namedView; } curMsg; curMsg.curTime = GetTheShow().GetShowTime(); ::PostMessage(HWND_BROADCAST, wm_Message, (WPARAM) m_hWnd, (LONG) &curMsg); Message received: struct recMsg{ COleDateTime curTime; CString namedView; } &in =*(recMsg*) lParam; currentTime = in.curTime //currentTime is COleDateTime I am obviously casting incorrectly. I could put value in a string if that is eas...

Arrays have me confused
I'm trying to use a userform to collect a list of words (i.e., 20) to later diplay in a shape or textbox (as flash cards) in my presentation.. What's the best way to collect and store my list? I know I could do something like word1 = userform1.textbox1.text, word2 = userform1.textbox2.text and so on but I thought an array would simplifiy things. The only problem is I'm completely confused when it comes to using arrays. Also, I guess since I'm here, how would I later retrieve my list for display in one textbox, one word at a time (e.g., click my word button and...