Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. DateTime::ParseExact

DateTime::ParseExact

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Certini
    wrote on last edited by
    #1

    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");
    

    }

    C L D 3 Replies Last reply
    0
    • M Mike Certini

      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");
      

      }

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      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, like date_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.<

      1 Reply Last reply
      0
      • M Mike Certini

        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");
        

        }

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        You do not mention which version of the compiler you are using; are you sure that it recognises nullptr as a NULL value?

        Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

        1 Reply Last reply
        0
        • M Mike Certini

          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");
          

          }

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups