-
December 3rd, 2003, 06:43 AM
#1
When I convert '12/3/2003' using COleDateTime::ParseDateTime, takes 12 as date. Why?
My regional setting is australia.
I have a string '12/3/2003' (mm/dd/yy) in US format to be parsed as COleDateTime.
When I convert using COleDateTime::ParseDateTime, it considers 12 as date and 3 as month.
I know this is because of my regional setting.
How to make ParseDateTime to consider the string as US date string?
Code:
CString sTimeString = "12/3/2003"; // 12 th month
COleDateTime oleTime;
oleTime.ParseDateTime(sTimeString,LOCALE_NOUSEROVERRIDE); // I tried this
//oleTime.ParseDateTime(sTimeString,0 ); // I tried this also.
AfxMessageBox(oleTime.Format("%m/%d/%y")); // the month 12 th becomes date
Displays 3/12/2003
How to instruct ParseDateTime to consider the string in US format ?
Thanks a lot for your helps
Anita Eugene
-
December 3rd, 2003, 11:05 AM
#2
Any solution based on Ctime ?
Even a solution based on CTime will help.
Thanks
Anita Eugene
-
December 3rd, 2003, 11:21 AM
#3
oleTime.ParseDateTime(_T("12/2/2003"),0,MAKELANGID(LANG_ENGLISH,SUBLANG_ENGLISH_US));
-
December 3rd, 2003, 11:34 AM
#4
Great !!!!
Thanks a lot.
Anita Eugene
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|