Results 1 to 6 of 6

Thread: C++ Dates...... HELP!!!!

  1. #1
    tbarnette
    Guest

    C++ Dates...... HELP!!!!

    I'm new to C++, have not done in a long time... I want to assign a date in the format of MM/DD/YYYY to a string..

    In VB, I'd do it like this: a$ = format$(now,"MM/DD/YYYY")

    How would you do something like this in C++?

    I can find localtime and then asctime conversions, but then I'd have to parse the strings to build a date. Surely there must be an easier way?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    You need to call the GetDateFormat API

  3. #3
    tbarnette
    Guest
    Thanks for the reply!

    Is that a win api? I have to do in straight C++ (Platform independant)... What library/header does that function reference?

    (btw saw your signature - was KPax a good movie? Trying to talk the wife into renting it...)

  4. #4
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    I don't know about C++, but I have used C dates a little. There's probably a standard C++ class for it, but in the meantime have a look here:

    http://www.cs.utah.edu/dept/old/texi...19.html#SEC309
    Harry.

    "From one thing, know ten thousand things."

  5. #5
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    This is all I turned up with a quick google:

    http://www-f9.ijs.si/~matevz/docs/C+.../ch05/ch05.htm

    You could probably use one of the classes in those examples.
    Harry.

    "From one thing, know ten thousand things."

  6. #6
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    yup, that a nice movie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width