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



0
michael (59)
11/7/2003 9:33:12 PM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
1248 Views

Similar Articles

[PageSpeed] 40

Try the following

        COleDateTime  dtCurrentDate ( COleDateTime::GetCurrentTime() );
        AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y
%H:%M") ) );

-- 
Cheers
Check Abdoul [VC++ MVP]
-----------------------------------

"Michael Tissington" <michael@nospam.com> wrote in message
news:O4YoFaXpDHA.1928@TK2MSFTNGP12.phx.gbl...
> 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
>
>
>


0
CheckAbdoul
11/7/2003 10:03:13 PM
Thanks, but this does not format it according to the Long Date format.

%#c automatically takes into account the local and this is what I need with
the exception of seconds.

-- 
Michael Tissington
http://www.tabtag.com
http://www.oaklodge.com


"CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
news:uSgtKsXpDHA.3688@TK2MSFTNGP11.phx.gbl...
> Try the following
>
>         COleDateTime  dtCurrentDate ( COleDateTime::GetCurrentTime() );
>         AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y
> %H:%M") ) );
>
> -- 
> Cheers
> Check Abdoul [VC++ MVP]
> -----------------------------------
>
> "Michael Tissington" <michael@nospam.com> wrote in message
> news:O4YoFaXpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > 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
> >
> >
> >
>
>


0
michael (59)
11/8/2003 12:17:32 AM
That is system dependant, you need to change the format in Control Panel to
remove the seconds.

HTH
-- 
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"Michael Tissington" <michael@nospam.com> wrote in message
news:OE3f71YpDHA.1928@TK2MSFTNGP12.phx.gbl...
> Thanks, but this does not format it according to the Long Date format.
>
> %#c automatically takes into account the local and this is what I need
with
> the exception of seconds.
>
> -- 
> Michael Tissington
> http://www.tabtag.com
> http://www.oaklodge.com
>
>
> "CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
> news:uSgtKsXpDHA.3688@TK2MSFTNGP11.phx.gbl...
> > Try the following
> >
> >         COleDateTime  dtCurrentDate ( COleDateTime::GetCurrentTime() );
> >         AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y
> > %H:%M") ) );
> >
> > -- 
> > Cheers
> > Check Abdoul [VC++ MVP]
> > -----------------------------------
> >
> > "Michael Tissington" <michael@nospam.com> wrote in message
> > news:O4YoFaXpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > > 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
> > >
> > >
> > >
> >
> >
>
>


0
11/8/2003 1:25:15 AM
OK, How can I get info if its 24 hour time format or 12 hour format ?

then I can either us

%H:%m or %I:m %p

-- 
Michael Tissington
http://www.tabtag.com
http://www.oaklodge.com


"Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message
news:5oSdnasNpOoO2DGiRVn-sA@comcast.com...
> That is system dependant, you need to change the format in Control Panel
to
> remove the seconds.
>
> HTH
> -- 
> ============
> Frank Hickman
> NobleSoft, Inc.
> ============
> Replace the _nosp@m_ with @ to reply.
>
>
> "Michael Tissington" <michael@nospam.com> wrote in message
> news:OE3f71YpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > Thanks, but this does not format it according to the Long Date format.
> >
> > %#c automatically takes into account the local and this is what I need
> with
> > the exception of seconds.
> >
> > -- 
> > Michael Tissington
> > http://www.tabtag.com
> > http://www.oaklodge.com
> >
> >
> > "CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
> > news:uSgtKsXpDHA.3688@TK2MSFTNGP11.phx.gbl...
> > > Try the following
> > >
> > >         COleDateTime  dtCurrentDate (
COleDateTime::GetCurrentTime() );
> > >         AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y
> > > %H:%M") ) );
> > >
> > > -- 
> > > Cheers
> > > Check Abdoul [VC++ MVP]
> > > -----------------------------------
> > >
> > > "Michael Tissington" <michael@nospam.com> wrote in message
> > > news:O4YoFaXpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > > > 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
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
michael (59)
11/8/2003 1:55:33 AM
For that I believe you would have to use the GetLocaleInfo API for the
LOCALE_SLONGDATE and/or LOCALE_STIMEFORMAT type and see if it contains the h
(12 hr) or H (24 hr)...

HTH
-- 
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"Michael Tissington" <michael@nospam.com> wrote in message
news:OBXGrsZpDHA.2776@tk2msftngp13.phx.gbl...
> OK, How can I get info if its 24 hour time format or 12 hour format ?
>
> then I can either us
>
> %H:%m or %I:m %p
>
> -- 
> Michael Tissington
> http://www.tabtag.com
> http://www.oaklodge.com
>
>
> "Frank Hickman" <fhickman_nosp@m_noblesoft.com> wrote in message
> news:5oSdnasNpOoO2DGiRVn-sA@comcast.com...
> > That is system dependant, you need to change the format in Control Panel
> to
> > remove the seconds.
> >
> > HTH
> > -- 
> > ============
> > Frank Hickman
> > NobleSoft, Inc.
> > ============
> > Replace the _nosp@m_ with @ to reply.
> >
> >
> > "Michael Tissington" <michael@nospam.com> wrote in message
> > news:OE3f71YpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > > Thanks, but this does not format it according to the Long Date format.
> > >
> > > %#c automatically takes into account the local and this is what I need
> > with
> > > the exception of seconds.
> > >
> > > -- 
> > > Michael Tissington
> > > http://www.tabtag.com
> > > http://www.oaklodge.com
> > >
> > >
> > > "CheckAbdoul" <checkabdoul at mvps dot org> wrote in message
> > > news:uSgtKsXpDHA.3688@TK2MSFTNGP11.phx.gbl...
> > > > Try the following
> > > >
> > > >         COleDateTime  dtCurrentDate (
> COleDateTime::GetCurrentTime() );
> > > >         AfxMessageBox( dtCurrentDate .Format( TEXT("%A %B %d, %Y
> > > > %H:%M") ) );
> > > >
> > > > -- 
> > > > Cheers
> > > > Check Abdoul [VC++ MVP]
> > > > -----------------------------------
> > > >
> > > > "Michael Tissington" <michael@nospam.com> wrote in message
> > > > news:O4YoFaXpDHA.1928@TK2MSFTNGP12.phx.gbl...
> > > > > 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
> > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
11/8/2003 9:08:12 AM
Reply:

Similar Artilces:

Controlling Chart formatting
Going mad - don't know if it is a general Excel chart problem o specific to Macs (or my MAC?) Various charts I have put together seem to change format at will usually when I save the file or print it. Changes are usuall restricted to font sizes of chart/data labels, sizes of text boxe and sizes of pies. Not even consistent - for example a shee containing 6 pies (printing on one page) will change the format an display of 2 or 3 of the pies but not the rest even though all ar derived from the same original so have the same formatting an options Any suggestions gratefully received Apologi...

Formatting email and web addresses in Excel
Hi all... I want to put email and web addresses in my worksheets, but I do not want them to be active links. IOW, they should be just text, not links to emails or web pages. I have tried formatting the cells as text and general. I have even put the web address without the www., but it still reformats it! Any tips??? Thanks! JJ Put a single quote (apostrophe) in front of the address -- Gary's Student "JohnnyJomp" wrote: > Hi all... > I want to put email and web addresses in my worksheets, but I do not want > them to be active links. IOW, they should be just tex...

Conditional Formatting 11-30-09
New to this.... I have a list of dollar amounts in column A. In column B, a 1 or 2 (yes or no) depending on whether the bid was awarded or not. I need to create a running total everytime a 1 is added to column B that equals the total of the dollar amounts next to each "1". =SUMIF(B:B,1,A:A) will work provided the columns have nothing else in them but the data for this topic. Otherwise, somethink like this with your actual ranges =SUMIF(B1:B100,1,A1:A100) BTW, this is not 'formatting' - that only changes the appearance of things. You need a formula to cond...

Help Please: Transferspreadsheet brings in odd format
I'm using Ac 2003, Win xp pro, Excel 2003. My sheet is formatted as text. Example: data is 3249388005 in Excel but imports as 3.24939e+009 in Access. I've formatted the target table to which the data is appended as Text. As both the Excel cells and the Access field is formatted as text, I don't know how to correct this. It appears this is a scientific notation type data format problem. Please help: how to I preserve the Excel format? Perico <Perico@discussions.microsoft.com> wrote: >I'm using Ac 2003, Win xp pro, Excel 2003. My sheet is formatted as text....

conditional formatting syntax
Hi, I learned from a previous post that using conditional formatting on a control in a subform won't work properly, if you are displaying more than one record in the subform. Thank you all for your kind assistance. So now I don't know the syntax for conditional formatting - I have searched the Access help files, my two programming books, I looked how I did it once in Excel; I tried various things in the subform but havent gotten it correct. Thank you for your patience. I am using Expression Is The two fields I want to compare are Oct and Nov. If Nov is greater than...

Format Cells Dialog Box Missing
I have tried multiple paths to get to it but I am unable to open the format cells dialog box. If I right-click on a set of cells and select "Format Cells..." I am returned to the spreadsheet with no dialog box opened. The same thing happens if I try to get to the dialog box through the ribbon on the ribbon bar. I can mouse over the link on the ribbon bar and see the miniture view of the dialog box, but if I click on it, nothing happens. Any ideas? Check whether the worksheet is protected? -- Remember to Click Yes, if this post helps! -------------------- (Ms...

the compose message format is greyed out in outlook
How can i enable the greyed out boxes and fields in the registry under XP SP2 ? in Outlook 2003 under the tab | Options | Mail format | I want to enable the fields "Choose a format for outgoing mail and change advanced settings" "Use Microsoft Office Word 2003 to edit e-mail messages" and "Use Microsoft Office Word 2003 to read Rich Text e-mail messages" Do you have Microsoft Word installed? Are you creating HTML, Rich Text or Plain Text email messages. "Marcel" <marcelmonsanto@yahoo.com> wrote in message news:0BB0D56D-3DE2-408...

add extra months with same format as a redesigned calendar
publisher 2003 - I have made changes to a normal calendar such as changed one colour. I then tried to save it as a file and also a template. When i open it on the screen and add extra months to the calendar, they appear with the original format not with my changes as expected. CAn somebody please help Open the color scheme menu and apply a new scheme or create one of your own. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "stormrider" <stormrider@discussions.microsoft.com> wrote in message news:225A8127-E635-48E2...

Reports sending PDF format on GP 9.0
I would like to request you to get solution for GP-9, Reports format sending through outlook as PDF format. I have installed Adobe writer and trying to send to PDF format. It’s giving the following error. "When you create a postscript file you have to send the host fonts. Please go t he printer properties “Adobe PDF Settings" page and turn off the option " Do not send fonts to Distiller" But I checked on the printer properties I could not find such option there. Please provide me the solution Regards, saifu From the General Page of the printer properties, selec...

Excel 2007 - Pivot Table - Conditional Formatting
I have a pivot table and everything is working great except for one problem. I have some conditional formatting on sum of numbers that works great. The problem is if I try to do conditional formatting based on the % of Total it is not working correctly. From what I can tell when I do conditional formatting based on the % of Total it appears it is actually still referencing the sum and not the %. For example: I have a sum of 52 somewhere in the data of the pivot table and the % of Total for that sum is 11%. If I do conditional formatting on the sum of 52 it works fine but if I do conditional f...

Format Text
Is there a way to format certain cells in a row so that some state abbreviations, e.g., NM, will have an asterisk appear after the abbreviation (NM*), but the actual value of the cell will be NM? 10 state abbreviations will have an asterisk after them (NH, NJ, PA, AL, MI, LA, MO, CO, CA, CA and AK). I can't hardcode the asterisk as these cells affect the value in other cells, and I need the actual value of the cell be the abbreviation without the asterisk. Any ideas? Thanks, Carroll Rinehart Sorry, just found an example. The custom format would be @"*". I can add the custom...

Format date
In an excel sheet(Excel 2002)we have 2 columns with a date in the format of (mm/dd/yyyy). These are displaying as a number(XXXXX)which is not what we want. I have tried to reformat the cells(format-cells-number-date) but nothing changes. On the input bar, it displays the date format correctly(mm/dd/yyyy). If I change to bold, it changes the cell. The sheet/cells are not locked. What else could be wrong? It sounds like your cell needs to be wider >-----Original Message----- >In an excel sheet(Excel 2002)we have 2 columns with a date >in the format of (mm/dd/yyyy). These are d...

Default date format
Is there a way to change the default date format in excel 2002 to onl use 2 digit years. I've looked through the options and don't se anything. Example: default: mm/dd/yyyy desired: mm/dd/yy Thanks in advanc -- gschime ----------------------------------------------------------------------- gschimek's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=39 View this thread: http://www.excelforum.com/showthread.php?threadid=27096 Go to <format><custom> and enter in the "type" box what you require Regards Bill K "gschimek"...

Formatting flyer for mailing...help.
I have designed a flyer in Publisher and I want the back to have a space for a mailing address and the upper or lower half have content. I had this option on one version I printed out...but now page 2 is just another template of the first page. I have the book Publisher Step by Step, but cannot find the solution in there either. I am using Publisher 2007 and my operating system is Windows Vista. Can someone help me with this, please? When you insert a new page, isn't it blank? There is a check off in the insert new page to duplicate all items on page 1, maybe you are inadverte...

conditional formatting referencing 3 cells by row in a range
Hi, I need to set up conditional formatting with 3 conditions and each condition is to look at 3 different cells in a row and determine if they meet the condition. Currently what I have setup does not limit the conditions to have all 3 in the same row...it will indicate that I have met the condition when in fact one of the values is only true if you look in different rows (see example). Here is what I have setup so far: condition 1 - AND((COUNTIF($E$19:$E$10000,$E19)>1),(COUNTIF($A$19:$A$10000,$A19)>1),(COUNTIF($F$19:$F$10000,$F19)>1)) condition 2 - AND((COUNTIF($E...

cut and paste format problem
I can format a cell to say be text, but then when I cut and paste my information (from a word document), it will not remember that I wanted text, or at least will still cut off the zero. Example, data is 040415, when I cut and paste it into excel it puts 40415. jen Try cutting from Word then in Excel, Paste Special>Text Gord Dibben Excel MVP On Thu, 18 Nov 2004 08:34:24 -0800, jenhow <jenhow@discussions.microsoft.com> wrote: >I can format a cell to say be text, but then when I cut and paste my >information (from a word document), it will not remember that I wanted tex...

Too Many Cell Formats #5
After struggling with this problem, I have finally found somewhat of a solution that has had some significant results. First with your workbook open, highlight cells that you want to remove the special formatting such as font, fill, borders, etc. Then select edit>clear>formats to clear the highlighted cells. This alone will not allow you to immediately add formatting back into your workbook. You first need to save the workbook and then close it. Reopen the file from excel, highlight the newly saved file in the open excel window. You will notice in the lower right hand corner of t...

Chart formatting
Hello, I have a vertical bar chart (ie. a 'column' chart) with staff names along the bottom (x) axis and their hours up the vertical (y) axis. The staff names are rotated by 90 degrees so they read 'upwards'. There are a large number of staff and to make the chart readable I split the staff into 2 equal groups and have a separate chart for each. The charts are identical in format (or at least I thought they were) and differ only in the data they display. On the 2nd chart, long staff names are sometimes not printed properly, the name is truncated. eg. 'Jeremiah Millhouse&#...

To many different cell formats #2
How do I resolve error message, "To many different cell formats"? ...

Formating Issues
I have a Publisher 2003 Brochure in progress. I only need the first page of this two page document. I can find no way to save only the first page of this work. Additionally, I've inserted a text box for a list of items and want to divide it into two columns. Need some guidance on how this would be done. Much thanks for any assistance. Go to page two, Edit, delete page. Save with a new name if you want both files. Right-click the text box, click format text box, Text Box tab, columns button. -- Mary Sauer http://msauer.mvps.org/ "Maurice" <Maurice@discussions.micr...

Disappearing Text in new excel files after format
Something has apparently changed on my Dell Latitude 610 laptop with my installation of Excel 2003. If I type text in a cell and then choose Format Cell - Wrap Text, the text disappears from the cell. It is still there, because you can see it on the edit text box at the top of the window. I do not change anything else about this text. All other formatting is at the default. It does not matter how long the text is. It can be short or long text. The font color is Automatic. The font is normal. If I unwrap the text, then it reappears. Very frustrating. Any help would be appreaciated. Th...

Can you conditional format bar and pie charts in Excel 2000?
Hello, I don't know if this is possible in excel 2000 but I figured I woul ask a quick question instead of continuing to spin my wheels on it. I there anyway to automatically conditional format the color of a pie o bar chart. In other words, I have a table of data that is going t change from month to month. The table I am graphing looks like this: Project Size Status Project A $2m Green Project B $.5m Green Project C $1.2m Red The number of projects and status' could change from month to month. want to create a pie (or bar) charts that will auto format the...

Pivot table formatting removed/lost/reverted upon refresh
I can't seem to maintain any formatting after I refresh the pivot table. I'm using Access 2007. EXCEL 2007 Try the following:- 1. Right click somewhere in your Pivot Table and select PivotTable Options . .. . 2. The PivotTable Options window should launch / Layout & Format tab / remove the tick (check) from Autofit column widths on update / OK You might also try, if you have lost formatting, re-applying it quickly by clicking in the Pivot Table / PivotTable Tools / Design contextual tab / PivotTable Styles group / clicking one of the styles in here will f...

Conditional Formatting
Hi Experts, I want to build a web page to display different coloured labels depending on what data a record contains. Similar to a workflow diagram. Thus if I have the flowing data Name Letter Meeting Completed Joe Blogs 01/03/2009 04/04/2009 Penny Smith 15/02/2009 David Smith 20/10/2009 03/01/2010 15/03/2010 3 labels would show on the web page (Letter, Meeting and Completed) If data exists in the field then the label will be green otherwise the label will be red. For Joe Blogs, the Letter and Meeting labels will be green but the Completed label wi...

Conditional formatting with cell styles
I like the cell styles and the fact that they can change if I change a workbook theme. I'd like to use these styles in conditional formats but I can only see manual settings for fonts, borders, fills etc in the conditional formatting options. Is there a way to specify that a conditional format should use a named cell style perhaps? Thanks for any clues you can give. Kevin ...