Posted By: brussell | Nov 7th, 2005 @ 9:49 AM
page 1 of 1
Comments: 3 | Views: 6132
I am trying to get the current date in the format of YearMonthDay (2005117) in C++.NET.

I have tried all sorts of ways, but can't get the date on it.

I have tried to take dt.Year and concat dt.Month and dt.Day, but end up with 200511.

I have tried taking the int dt.Day and pass it into an array of string versions of dates.
The command window gives me a good value, but string pointer it is returning to is bad.

The last thing I just tried was
          
            DateTime dt = DateTime::Now;
            String* delimStr = S"/";
            Char delimiter[] = delimStr->ToCharArray();
       
            String* saDate[] = dt.ToShortDateString()->Split( delimiter );
            String* sDate = saDate[2];
            sDate = String::Concat( sDate, saDate[0] );
            sDate = String::Concat( sDate, saDate[1] );

and that gets me 200511 also.

Any ideas? This doesn't make any sense.
Year and month work fine, but no matter what, I can't get a date...

Maurits
Maurits
AKA Matthew van Eerde
brussell wrote:
I am trying to get the current date in the format of YearMonthDay (2005117) in C++.NET.


That format is ambiguous, isn't it?  You get 2005117 for both 2005-01-17 and 2005-11-07.

EDIT: Oh, and I'm guessing that dt.Day is the day of the week.
EDIT2: No, I'm wrong... never mind.
page 1 of 1
Comments: 3 | Views: 6132