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
945 Views

Similar Articles

[PageSpeed] 56

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:

How to sent for cell: font size=7,text format in VBA
I am losting "font size" and "text format" in Cells after I do .Range().Clear I wonder how to set in VBA: - font size for cell - formatting "text" for cell Excel XP. I am not sure about translation of above because I use Polish version of Excel. Thanks for help, Mark Hi Maybe you can use ClearContents instead If not post back and I give you a example -- Regards Ron de Bruin http://www.rondebruin.nl "netx" <user72wytnij@go2.pl> wrote in message news:42f78ef0$0$15476$f69f905@mamut2.aster.pl... >I am losting "font size" and &...

keep pivotchart formatting
Hi! Is it possible to keep all the formatting in a pivotchart after i refresh the data. Although i check the preserve formatting option, every time i refresh tha data, i loose all the changes i made in the chart, and it allways goes back to the default excel formatting. Thanks You may set the property "HasAutoFormat" to False. The code would be like the following: ActiveSheet.PivotTables("PivotTable1").HasAutoFormat = False. Regards. "Pmxgs" <pmxgs@netvisao.pt> wrote in message news:newscache$cl5lph$7ai$1@newsfront4.netvisao.pt... > Hi! > ...

Help with Conditional Formatting #3
Hi, I have a spreadsheet. Column A has a question. The next 6 columns have the answer. The next column has the right answer. Is there a way I can do conditional formatting so that the right answer is formatted with a gray background to show it is right. I like having the answer at the end but I was hoping not to have to manually gray each correct answer box. Thanks in advance. I know I might need an IF statement too or something. Select cells B2:H100 (or whatever the rows are) Goto Format>Conditional Formatting Change Condition 1 To Formula Is Add a formula of =B2=$I2 Click Format Selec...

Format column auto to "Hidden"
How do I set up an automatic column format to "zero" width or hidden. What I want to do is when a particular cell has a certain value I want another column or row to hide itself and when the cell is changed to another value the column will show up again. I have looking through various excel developer books and cannot seem to find the answer. I even tried a macro and still could not get it to work. In other words, if cell j5 = x (text) or a number - lets say 5 then column "b" goes to hidden or zero width --- then when cell j5 is not the x or 5 column "b&qu...

weird formatting
Hi all, Anyone ever seen this before? This was what happened to a mac excel spreadsheet the user doesnt know how she did this but i wondered if anyone might recognize this current format. In hopes we can change it back. Formatting is below. thx for any help ... Ed 2oC//9yIAGAf0L//2tC//9qQAAg= </data> <data> AG0AFgAAPz8/Pz8/Pz8BcF9AAAAA JQUubXBlZwAADHZpZGVvL3gtbXBl Zw9NUEVHIG1lZGlhIGZpbGVtc2Z0 AAAAMr//AAIRUXVpY2tUaW1lIFBs dWdpbgDagL//3IgAYB/Qv//a0L// 2pAACA== </data> <data> AGwAFgAAPz8/Pz8/Pz8B...

formatting Quotes
Have a client who wants to prepare quotes through MS CRM but then format them to a given template and send to his customers as word/pdf or printed documents. Anyone have advice on how to do this or do we need to wait for the Office Information Bridge for CRM? Appreciate any advice Thanks Roger If you search this group (Google is ideal) you will find out how to achieve this using Crystal. "Roger" <roger_id@hotmail.com> wrote in message news:%23rvz$gAnEHA.2096@TK2MSFTNGP15.phx.gbl... > Have a client who wants to prepare quotes through MS CRM but then format > ...

group-object formatting question
Hello there, one question on the formatting of the group-object output. Using dir | Get-Acl | ForEach-Object { $_.Access } | Group-Object IdentityReference I get a table with Count, Name and Group. Count Name Group ----- ---- ----- 9 predefines\Administr... {System.. 9 grpTP-FILES-IT-RW {System.Secur How can I access just the Name field of this output? Thanks very much, Uwe R2V0IHRoZSBwcm9wZXJ0eSB2YWx1ZSBmcm9tIGVhY2ggW01pY3Jvc29mdC5Qb3dlclNoZWxsLkNv bW1hbmRzLkdyb3VwSW5mb10NCg0KZGlyIHwgR2V0LU...

hidden formatting symbols
In Word I'm able to see paragraph marks and other hidden formatting symbols. Can this be done in powerpoint 2007? I've searched and haven't found it. Seeing the hidden symbols would help when editing a slide within a text box Thanks -- Dave Yep would be useful but you can't do it AFAIK. "Dave R" <DaveR@discussions.microsoft.com> wrote in message news:8755AD11-7B3B-47E1-A6D4-DA54B8AE87BB@microsoft.com... > In Word I'm able to see paragraph marks and other hidden formatting > symbols. > Can this be done in powerpoint 2007? I'...

Copy conditional formatting across multiple rows?
I am using Excel 2003 and have created conditional formatting on the first row in the worksheet with a formula as follows =R3C3="No". This works correctly and the formatting of the row works as expected. If I now copy the formatting to the row below, using the 'Fill formatting Only' option when pasting the formatting is still based on the cell referenced in the intial formatting. Is there anyway to reference column 3 more generically in the formatting formula so I do not have to modify the formula on every row? TIA Gil Gil, R3C3 is absolute referencing. You can e...

Conditional Formatting #22
I have 2 cells: A1 (yes or no value) B1 (numeric value) I want to apply conditional formatting to cell B1 that says if A1="yes" then contents of B1 are bold. How can I do this? Jess, Select B1. Format - Conditional formatting - formula: =A1="yes" -- Earl Kiosterud mvpearl omitthisword at verizon period net ------------------------------------------- "Jess" <Jess@discussions.microsoft.com> wrote in message news:F28BDFA7-959E-4F39-BF7A-01872C9CA3EF@microsoft.com... >I have 2 cells: > > A1 (yes or no value) > B1 (numeric value) > >...

Formatting sheets
Hi, Is there a way to cascade formatting in an xls? I.e I have a xls with one sheet in it, for each new sheet added I woul like it to have the formatting etc of the first sheet. Is this possible? Thanks, -- Message posted from http://www.ExcelForum.com Hi You can set up a default for new sheets/workbooks but these are for all new sheets/workbooks and not one default per workbook. Save a sheet with the formatting you want (incl font, format, print layout, margins etc) and save it as a template (xlt) called sheet.xlt in your XLStart folder. You can do the same with a workbook and save ...

Specify format in source data
can you specify format information in the source data. for example coul you specify that a segment in a pie chart for sales of oranges shoul always be orange, apples green etc et -- Message posted from http://www.ExcelForum.com In this post I show a macro that colors a series based on the series name. It would not be a major effort to base the color instead on the X value of a point. Of course, if the fruits are always in the same order, just keep using a copy of the same chart, or turn it into a custom chart type: http://peltiertech.com/Excel/ChartsHowTo/CreateCustomTypes.html - J...

mail merge formatting
I have a Publisher brochure merged with an Excel spreadsheet. Many of the fields go into a table. The cells in Excel are formatted as currency but don't show up as currency in the Publisher document. I can't find how to format the table or the table cells in Publisher as currency. Thank you for your help. okschlaps wrote: > I have a Publisher brochure merged with an Excel spreadsheet. Many of the > fields go into a table. The cells in Excel are formatted as currency but > don't show up as currency in the Publisher document. I can't find how to > format the ta...

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

xml format problem
Hi I'm using the following code to create xml string: Dim Doc As New System.Xml.XmlDocument Dim newAtt As System.Xml.XmlAttribute Dim dec As System.Xml.XmlDeclaration dec = Doc.CreateXmlDeclaration("1.0", Nothing, Nothing) dec.Encoding = "UTF-8" Doc.AppendChild(dec) Dim DocRoot As System.Xml.XmlElement = Doc.CreateElement("userlist") newAtt = Doc.CreateAttribute("ACTION") newAtt.Value = vAction DocRoot.Attributes.Append(newAtt) newAtt = Doc.CreateAttribute("VENDORNAME") newAtt.Value = vVendorName DocRoot.Attributes.Append(newAtt) Doc.A...

Time formats
I am creating a template which requires the user enter a time (not present time, flight times), for example the user will be listing a number of flight arrivals and departures and what I want to do is have the user simply enter something like 804p and have the cell display it as 8:04 pm. I have looked at some custom formats and nothing seems to be able to do this. Any help would be appreciated. Thanks! Tracey ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ See http:...

Formatting in CSV
Hi I create a Comma Separated Value file (csv) from my VB application, then open that file with Excel. Excel recognises the commas, and splits the records into separate fields as expected. Can I set properties for rows or columns or cells ? Like bolding, or font size, etc. Thanks Robert -- RobertLees ------------------------------------------------------------------------ RobertLees's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26580 View this thread: http://www.excelforum.com/showthread.php?threadid=486488 Yes. Even though the .csv file contains no fo...

Converting Publication to PDF Format
I have a 16 page newsletter created in publisher 2007. The format is 11 x 17, two sided, booklet. How do I convert the publication into a PDF format that will have the pages running consecutively? I know how to convert to PDF I just can't figure out how to set up the publication in order to have the pages running in order? I'm thinking it has something to do with setting up the Master Page/s. Any help is appreciated. Do you not get what you want when with the Pub file open, File, Print as..., select the PDF printer, and OK, starting the conversion to PDF? -- Don Vancouver, U...

VLook-Up Possibly Conditional Formatting
I am working on a spreadsheet that has three columns. A(Equipment Description) C (Part Number) and AA (Price Each) What I would like to be able to do is to choose either column A as a drop down or Column C as a drop down (be able to start entering and it jump to the description) and after I choose an item out of A or C that it would auto populate the the other colmun that was not choosen along with the price. The other catch is that I do not want the price list description nor part number within the same workbook. Thank you in advance for your assistance. You can create dr...

formatting issues
In Outlook, when a create a 'letter template' style Signature (with right & left justified text), I am experience a problem with the RIGHT JUSTIFIED TEXT lining up properly. Esp when printing, even if on-screen looks justified, some lines on the right side of my signature look skewed. Can anyone help? ...

ExcelReport
Please access http://www.ljzsoft.com ExcelReport is a report generator to generate reports in Microsoft Excel format. If you know how to use Excel and write SQL statements, you can use ExcelReport to create all kinds of reports as you need. Furthermore, with one time configuration, you can easily build periodic reports such as daily, weekly, monthly and annual reports. ...

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

reading .mdb in access 97 format
Pliz help me how can I be able to read a .mdb with access 97 or maybe its impossible "Read?" You are not giving us much to go on here... are you getting error messages? If you have an Access .mdb file and you try to use Access '97 to read it, what happens? It may be that the .mdb file was written with a newer version of Access ... if so, you could either use a newer version of Access, or you could ask whoever created the .mdb to re-save it in Access '97 format. -- Regards Jeff Boyce Microsoft Office/Access MVP http://mvp.support.microsoft.com/ Microsoft IT Academy P...

automatic formatting
i use microsoft outlook calendar for all our daily appointments. i do not want to have the highlight feature. when i ask the assistant, i do as it says, but i cannot click the automatice formatting (it is gray and will not allow access) how do I get automatic formatting so that I can get rid of the highlighting and add color thank you ...

Varying format
Is there any way to format a cell differently depending on the number of decimal places typed in? What I need is a minimum of 2dp but 3 if the typed entry matches. eg 1.2 appears as 1.20 and 1.234 appears as typed. TIA Ian Hi! Try formatting the cell with a custom number format such as 0.00## Al -- Alf ----------------------------------------------------------------------- AlfD's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=478 View this thread: http://www.excelforum.com/showthread.php?threadid=27494 "AlfD" <AlfD.1f5q6o@excelforum-nospam.c...