Results 1 to 6 of 6

Thread: How to format COleDateTime

  1. #1
    Join Date
    Sep 2010
    Posts
    72

    How to format COleDateTime

    I was developing the project in the visual c++ platform where I got struck with the date and time format I want to know when I’m using:
    Code:
    COleDateTime e(2011, 6, 11, 0,0,1);
    tprintf(e.Format());
    Is giving me the output of "6/11/2011 12:00:01 AM" and when I’m trying the code:
    COleDateTime e(2011, 9, 11, 0,0,0);
    tprintf(e.Format());
    Then why it is giving the output like this "9/11/2011"? Does anyone know the reason behind it?

  2. #2
    Join Date
    May 2009
    Posts
    527

    Re: How to format COleDateTime

    I had search for it on the net. It really simple and required a little bit logic to do so. This kind is as well use toward corresponding to date-only or else time-only values. According to the rule, the date 0 like if you write (29 November 1980) is most probably used in favor of only time values. In the same way, the time 0:00 which is also known as a midnight is usually used for the only the date values. Hope this will help you.

  3. #3
    Join Date
    Apr 2009
    Posts
    488

    Re: How to format COleDateTime

    That kind of date time format is usually used in the specification of national language for date or time i.e. local ids. By making use of an local parameter and if your are specifying the value as 0(12 June 1990) as per the data and time format this will only going to print the date value in the same way in the default parameters it will only going to print an date value only if the time value in it is 0 which mean midnight. You can even print midnight in your result by providing the value as 0 (12 June 1990, midnight).

  4. #4
    Join Date
    Mar 2010
    Posts
    154

    Re: How to format COleDateTime

    Even I was searching for the same I think so it’s only on older version? In the older version it use to run in its own container but now in the new version it use to run in the web browser which make it own search with the help of API which is well-suited with the windows 9x. I don’t know why they had made the coledate time format as it’s really bad in working with the time format for the midnight and if you try in your program.

  5. #5
    Join Date
    May 2009
    Posts
    529

    Re: How to format COleDateTime

    You can try something new for the parameter which is not default.
    Code:
    LOCALE_NOUSEROVERRIDE make use of the system default settings.
    VAR_TIMEVALUEONLY pay no attention to the date section throughout parsing.
    VAR_DATEVALUEONLY pay no attention to the time section throughout parsing.
    Use anyone of them. It is used for the local flags.

  6. #6
    Join Date
    May 2009
    Posts
    543

    Re: How to format COleDateTime

    Why you are not explicitly specifying which ever format you needed. For window user local format you can use this
    Code:
    #include <windows.h>
    #include <ATLComTime.h>
    int main()
    { COleDateTime q1(2011, 9, 11, 0,0,1);
     _tprintf("%s\n", q1.Format(TEXT("%c")));
    COleDateTime w1(2011, 9, 11, 0,0,0);
    _tprintf("%s\n", w1.Format(TEXT("%c")));
    return 0;
    }
    This will give an output as
    09/11/11 00:00:01
    9/11/2011

Similar Threads

  1. How to convert math text PDF format to Kindle readable format
    By The#Gaelic in forum Portable Devices
    Replies: 7
    Last Post: 23-02-2012, 12:09 PM
  2. Unable to format nokia 5130 with format codes
    By Lashawn in forum Portable Devices
    Replies: 5
    Last Post: 18-03-2010, 09:51 AM
  3. Replies: 8
    Last Post: 26-02-2010, 10:33 PM
  4. Unable to convert djvu format files in JPEG format
    By Suzane in forum Windows Software
    Replies: 2
    Last Post: 11-05-2009, 05:14 PM
  5. Replies: 3
    Last Post: 06-10-2006, 03:32 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,907,531.87497 seconds with 17 queries