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. Other Discussions
  3. The Weird and The Wonderful
  4. What will you call this???

What will you call this???

Scheduled Pinned Locked Moved The Weird and The Wonderful
questionworkspace
23 Posts 12 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.
  • A AhsanS

    Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

    this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

    Guess what will above code return. I found it in a file.

    Ahsan Ullah Senior Software Engineer

    P Offline
    P Offline
    Paul Conrad
    wrote on last edited by
    #14

    What will you call this? A mess. Needs to be cleaned up and broken down a bit.

    "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

    A 1 Reply Last reply
    0
    • P Paul Conrad

      What will you call this? A mess. Needs to be cleaned up and broken down a bit.

      "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

      A Offline
      A Offline
      AhsanS
      wrote on last edited by
      #15

      And what if all this mess is totally of no use???

      Ahsan Ullah Senior Software Engineer MCTS 2.0

      1 Reply Last reply
      0
      • T Thomas Weller 0

        Sure, you can see it that way... Regards Thomas

        _Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

        Programmer - an organism that turns coffee into software._

        V Offline
        V Offline
        vlebed01
        wrote on last edited by
        #16

        Excellent

        1 Reply Last reply
        0
        • A AhsanS

          You are wrong. It runs the same thing it gets as input. I was getting an error and i had to debug the code when i found it. that after doing all that stuff it was doing no change to original values. Surprised???? ;P

          Ahsan Ullah Senior Software Engineer

          R Offline
          R Offline
          RubensFarias
          wrote on last edited by
          #17

          Actually, "that" removes the 'seconds [and milliseconds]' part from entered datetime, so "2008-11-10 08:00:30.123" => "2008-11-10 08:00:00". Ugly, I agree.

          P 1 Reply Last reply
          0
          • A AhsanS

            Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

            this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

            Guess what will above code return. I found it in a file.

            Ahsan Ullah Senior Software Engineer

            L Offline
            L Offline
            Louis Cipher
            wrote on last edited by
            #18

            A compound-complex sentence.

            1 Reply Last reply
            0
            • R RubensFarias

              Actually, "that" removes the 'seconds [and milliseconds]' part from entered datetime, so "2008-11-10 08:00:30.123" => "2008-11-10 08:00:00". Ugly, I agree.

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #19

              Depends on what "Logic.DateConfigurer.DateFormatWithTime" is.

              A 1 Reply Last reply
              0
              • P PIEBALDconsult

                Depends on what "Logic.DateConfigurer.DateFormatWithTime" is.

                A Offline
                A Offline
                AhsanS
                wrote on last edited by
                #20

                It contains "DD MMM YYYY HH:mm:ss"

                Ahsan Ullah Senior Software Engineer MCTS 2.0

                P 1 Reply Last reply
                0
                • A AhsanS

                  It contains "DD MMM YYYY HH:mm:ss"

                  Ahsan Ullah Senior Software Engineer MCTS 2.0

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #21

                  Then the format is changed too.

                  1 Reply Last reply
                  0
                  • A AhsanS

                    Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

                    this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

                    Guess what will above code return. I found it in a file.

                    Ahsan Ullah Senior Software Engineer

                    C Offline
                    C Offline
                    cliran
                    wrote on last edited by
                    #22

                    Code Reviewer: "wtf dude?!" Programmer: "ah... but it works!" indeed, if code written like THIS can actually work, than there must be some king of supreme being..

                    1 Reply Last reply
                    0
                    • A AhsanS

                      Assume that pTimeText is containing 2 dates seperated by space. Like pTimeText = "31/12/2008 15:36 29/12/2008 15:36"

                      this.txtTime.Text = Convert.ToDateTime(pTimeText.Substring(0, pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime) + Environment.NewLine + Convert.ToDateTime(pTimeText.Substring(pTimeText.IndexOf(":") + 3)).ToString(Logic.DateConfigurer.DateFormatWithTime);

                      Guess what will above code return. I found it in a file.

                      Ahsan Ullah Senior Software Engineer

                      M Offline
                      M Offline
                      Megidolaon
                      wrote on last edited by
                      #23

                      *points and laughs* Pointless. Really. The DateTime class can can convert a string to date. Separating the both dates must be done manually, but the conversion can be done by the DateTime class.

                      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