DateTime::ParseExact
-
Can someone help me with the getting my ParseExact working? Though following guidance from MSDN site I am still incorrect with my syntax. The error I am receiving is the following:
Error C2665: 'System::DateTime::ParseExact' : none of the 3 overloads could convert all the argument types.
C2665- Error Description: 'function' : none of the number1 overloads can convert parameter number2 from type 'type'#include #include #include #include #using using namespace std;
using namespace System;
using namespace System::Globalization;
using namespace System::Collections;void main()
{
//System::Collections::IEnumerator^ en = CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
//System::Globalization::CultureInfo^ MyCI = gcnew CultureInfo("en-US",false);
//System::Globalization::DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;std::string dateString = "MAY\_03\_2010"; std::string format = "MMM\_dd\_yyyy"; // DateTime dt = DateTime::Now; DateTime dateTime = DateTime::ParseExact(dateString,format,nullptr); //System::DateTime dateTimevalue = System::DateTime::ParseExact(dateString,"MMMddyyyy",CultureInfo.InvariantCulture); system("pause");
}
-
Can someone help me with the getting my ParseExact working? Though following guidance from MSDN site I am still incorrect with my syntax. The error I am receiving is the following:
Error C2665: 'System::DateTime::ParseExact' : none of the 3 overloads could convert all the argument types.
C2665- Error Description: 'function' : none of the number1 overloads can convert parameter number2 from type 'type'#include #include #include #include #using using namespace std;
using namespace System;
using namespace System::Globalization;
using namespace System::Collections;void main()
{
//System::Collections::IEnumerator^ en = CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
//System::Globalization::CultureInfo^ MyCI = gcnew CultureInfo("en-US",false);
//System::Globalization::DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;std::string dateString = "MAY\_03\_2010"; std::string format = "MMM\_dd\_yyyy"; // DateTime dt = DateTime::Now; DateTime dateTime = DateTime::ParseExact(dateString,format,nullptr); //System::DateTime dateTimevalue = System::DateTime::ParseExact(dateString,"MMMddyyyy",CultureInfo.InvariantCulture); system("pause");
}
Could it be that there is a function (or type or whatever) called "format" somewhere declared in one of those namespaces and the compiler thinks you are trying to pass that to ParseExact? Try renaming your
format
variable to something else, likedate_format
or somesuch and see if it changes anything.> The problem with computers is that they do what you tell them to do and not what you want them to do. < > If it doesn't matter, it's antimatter.<
-
Can someone help me with the getting my ParseExact working? Though following guidance from MSDN site I am still incorrect with my syntax. The error I am receiving is the following:
Error C2665: 'System::DateTime::ParseExact' : none of the 3 overloads could convert all the argument types.
C2665- Error Description: 'function' : none of the number1 overloads can convert parameter number2 from type 'type'#include #include #include #include #using using namespace std;
using namespace System;
using namespace System::Globalization;
using namespace System::Collections;void main()
{
//System::Collections::IEnumerator^ en = CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
//System::Globalization::CultureInfo^ MyCI = gcnew CultureInfo("en-US",false);
//System::Globalization::DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;std::string dateString = "MAY\_03\_2010"; std::string format = "MMM\_dd\_yyyy"; // DateTime dt = DateTime::Now; DateTime dateTime = DateTime::ParseExact(dateString,format,nullptr); //System::DateTime dateTimevalue = System::DateTime::ParseExact(dateString,"MMMddyyyy",CultureInfo.InvariantCulture); system("pause");
}
You do not mention which version of the compiler you are using; are you sure that it recognises
nullptr
as aNULL
value?Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
Can someone help me with the getting my ParseExact working? Though following guidance from MSDN site I am still incorrect with my syntax. The error I am receiving is the following:
Error C2665: 'System::DateTime::ParseExact' : none of the 3 overloads could convert all the argument types.
C2665- Error Description: 'function' : none of the number1 overloads can convert parameter number2 from type 'type'#include #include #include #include #using using namespace std;
using namespace System;
using namespace System::Globalization;
using namespace System::Collections;void main()
{
//System::Collections::IEnumerator^ en = CultureInfo::GetCultures(CultureTypes::SpecificCultures)->GetEnumerator();
//System::Globalization::CultureInfo^ MyCI = gcnew CultureInfo("en-US",false);
//System::Globalization::DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;std::string dateString = "MAY\_03\_2010"; std::string format = "MMM\_dd\_yyyy"; // DateTime dt = DateTime::Now; DateTime dateTime = DateTime::ParseExact(dateString,format,nullptr); //System::DateTime dateTimevalue = System::DateTime::ParseExact(dateString,"MMMddyyyy",CultureInfo.InvariantCulture); system("pause");
}
You might have slightly more luck by asking this question in the proper forum.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous