| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi All,
I'm using vc++.net and have a string that represents a date. "122804"(mmddyy) Any ideas on using DateTimeFormatInfo to take that value and make it: ( or How to write a Custom parser class for this numeric Data ) "20041228" (yyyymmdd) or if not possible: "041228"(yymmdd) Any help would be great. Thanks in Advance ... Rajan Kapadia |
|
#2
|
|||
|
|||
|
Re: Custom String DateFormating in VC++.Net
You could do it with CStrings.
Code:
CString strMDY = "122804";
CString strYMD;
strYMD.Format("20%s%s", strMDY.Right(2), strMDY.Left(4));
|
|
#3
|
|||
|
|||
|
Thanks for u r Reply .....
But at Runtime I only know what is come as a text for my Date!!! various possibility are : mmddyyyy mdyyyy mmdyyyy mddyyyy mmdy mddy mdyy mddyy mmdyy mmddy mmddyy mdy mmd ddm I m Confused due to ambiguation for this text( here ... Numerics) comes as a 6,5,4,3 digits .... (i.e.: for 5digits --> mddyy,mmdyy,mmddyy) how to handle these situations ....... I m to'much Confuseed !......! can any one help me for this soluation?? thanks in advance!! Rajan Kapadia |
|
#4
|
|||
|
|||
|
Re: Custom String DateFormating in VC++.Net
moved to VC.NET forum.
Datatime class has function ToString()... where you can specify the format you want to see... Dateime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
|
#5
|
|||
|
|||
|
Quote:
Thanks for reply... but ,, I have mantion clearly how I can Dis-ambiguates between possiblty of the same string divde in to same but diffrent parts.... i.e: for 5digits --> mddyy,mmdyy,mmddyy How to handle this ??? other Varios possibility are : mmddyyyy ( 8 digit max) mdyyyy mmdyyyy mddyyyy mmdy mddy mdyy mddyy mmdyy mmddy mmddyy mdy mmd ddm ( 3 digit min) I m Confused due to ambiguation for this text( here ... Numerics) comes as a 6,5,4,3 digits .... (i.e.: for 5digits --> mddyy,mmdyy,mmddyy) how to handle these situations ....... I m to'much Confuseed !......! |
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|