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#
  4. DataSet parse date "dd/mm/yyyy"

DataSet parse date "dd/mm/yyyy"

Scheduled Pinned Locked Moved C#
question
7 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.
  • J Offline
    J Offline
    juliogyn
    wrote on last edited by
    #1

    I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:

    string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();

    _dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);

    But not work. What can i do ?

    L F F 3 Replies Last reply
    0
    • J juliogyn

      I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:

      string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();

      _dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);

      But not work. What can i do ?

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

      juliogyn wrote:

      What can i do ?

      Support on formatting a column in a ListView[^]

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      J 1 Reply Last reply
      0
      • L Lost User

        juliogyn wrote:

        What can i do ?

        Support on formatting a column in a ListView[^]

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        J Offline
        J Offline
        juliogyn
        wrote on last edited by
        #3

        I'm using WPF, the listview not contains listview.subitem.

        1 Reply Last reply
        0
        • J juliogyn

          I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:

          string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();

          _dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);

          But not work. What can i do ?

          F Offline
          F Offline
          fjdiewornncalwe
          wrote on last edited by
          #4

          As per this answer: Source

          Simple change the StringFormat in your binding.

          DisplayMemberBinding="{Binding Path=field_date, StringFormat='dd/MM/yyyy'}"

          I wasn't, now I am, then I won't be anymore.

          J 1 Reply Last reply
          0
          • F fjdiewornncalwe

            As per this answer: Source

            Simple change the StringFormat in your binding.

            DisplayMemberBinding="{Binding Path=field_date, StringFormat='dd/MM/yyyy'}"

            I wasn't, now I am, then I won't be anymore.

            J Offline
            J Offline
            juliogyn
            wrote on last edited by
            #5

            Very very tnks Marcus Kramer. Its work

            1 Reply Last reply
            0
            • J juliogyn

              I'm using dataset for get values the table on access. The field date_ is shown in listview on format mm/dd/yyyy, but i need format dd/mm/yyyy. I load values in listview with the code: listview_.DataContext = _dataSet; I tried:

              string strDate = _dataset.Table["table"].Rows[0]["field_date"].ToString();

              _dateset.Tables["table"].Rows[0]["field_date"] = DateTime.ParseExact(strDate, "dd/MM/yyyy", CultureInfo.CurrentCulture);

              But not work. What can i do ?

              F Offline
              F Offline
              Forbiddenx
              wrote on last edited by
              #6

              I want to add.. DateTime.TryParse(x) is a good method to see if the date is even going to parse first.. also... it does not account for null data.. so you may need to add a little logic there to handle null.

              =)

              J 1 Reply Last reply
              0
              • F Forbiddenx

                I want to add.. DateTime.TryParse(x) is a good method to see if the date is even going to parse first.. also... it does not account for null data.. so you may need to add a little logic there to handle null.

                =)

                J Offline
                J Offline
                juliogyn
                wrote on last edited by
                #7

                tnks forbiddenx :)

                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