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. SetDate

SetDate

Scheduled Pinned Locked Moved The Weird and The Wonderful
helpquestion
13 Posts 6 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.
  • L Offline
    L Offline
    loctrice
    wrote on last edited by
    #1

    Function SetDate(ByVal nYear As Long, ByVal nMonth As Long, ByVal nDay As Long, ByVal nHour As Long, ByVal nMinute As Long, ByVal nSecond As Long) As Date
    Dim dTemp2 As New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
    Return dTemp2
    End Function

    really? This is probably one of the best things this guy has done so far. I was advised not to put his code on this forum though. This one I just couldn't help.

    If it moves, compile it

    B A B 3 Replies Last reply
    0
    • L loctrice

      Function SetDate(ByVal nYear As Long, ByVal nMonth As Long, ByVal nDay As Long, ByVal nHour As Long, ByVal nMinute As Long, ByVal nSecond As Long) As Date
      Dim dTemp2 As New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
      Return dTemp2
      End Function

      really? This is probably one of the best things this guy has done so far. I was advised not to put his code on this forum though. This one I just couldn't help.

      If it moves, compile it

      B Offline
      B Offline
      Brisingr Aerowing
      wrote on last edited by
      #2

      Issues I found: 1. It doesn't even set anything 2. It uses Long (Int64) while the constructor takes Integer (Int32) 3. Declares a temporary variable to be returned the next line 4. Why is it dTemp_2_? My way (I will keep the same name, mainly because I can't think of any other):

      Function SetDate(ByVal nYear As Int32, ByVal nMonth As Int32, ByVal nDay As Int32, ByVal nHour As Int32, ByVal nMinute As Int32, ByVal nSecond As Int32) As Date
      Return New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
      End Function

      All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

      L 1 Reply Last reply
      0
      • B Brisingr Aerowing

        Issues I found: 1. It doesn't even set anything 2. It uses Long (Int64) while the constructor takes Integer (Int32) 3. Declares a temporary variable to be returned the next line 4. Why is it dTemp_2_? My way (I will keep the same name, mainly because I can't think of any other):

        Function SetDate(ByVal nYear As Int32, ByVal nMonth As Int32, ByVal nDay As Int32, ByVal nHour As Int32, ByVal nMinute As Int32, ByVal nSecond As Int32) As Date
        Return New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
        End Function

        All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

        L Offline
        L Offline
        loctrice
        wrote on last edited by
        #3

        His calls to this function are to set a date variable = function call. He literally used this function for nothing. My solution was :

        myVariableName = new Date(..yada..yada..yada...)

        Zac Greve wrote:

        It uses Long

        Every numeric variable he declaired in the entire project was a long.

        If it moves, compile it

        G B 2 Replies Last reply
        0
        • L loctrice

          His calls to this function are to set a date variable = function call. He literally used this function for nothing. My solution was :

          myVariableName = new Date(..yada..yada..yada...)

          Zac Greve wrote:

          It uses Long

          Every numeric variable he declaired in the entire project was a long.

          If it moves, compile it

          G Offline
          G Offline
          GibbleCH
          wrote on last edited by
          #4

          I'd rather that then the people who use strings for everything...*shudder*

          B 1 Reply Last reply
          0
          • L loctrice

            His calls to this function are to set a date variable = function call. He literally used this function for nothing. My solution was :

            myVariableName = new Date(..yada..yada..yada...)

            Zac Greve wrote:

            It uses Long

            Every numeric variable he declaired in the entire project was a long.

            If it moves, compile it

            B Offline
            B Offline
            Brisingr Aerowing
            wrote on last edited by
            #5

            Well, at least he wasn't stringing you along. GROAN!

            All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

            L 1 Reply Last reply
            0
            • G GibbleCH

              I'd rather that then the people who use strings for everything...*shudder*

              B Offline
              B Offline
              Brisingr Aerowing
              wrote on last edited by
              #6

              GibbleCH wrote:

              *shudder*

              Shiver, shake, and convulse!

              All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

              1 Reply Last reply
              0
              • B Brisingr Aerowing

                Well, at least he wasn't stringing you along. GROAN!

                All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

                L Offline
                L Offline
                loctrice
                wrote on last edited by
                #7

                It seems to me that you are turning regular expressions into puns for amusement.

                If it moves, compile it

                B 1 Reply Last reply
                0
                • L loctrice

                  It seems to me that you are turning regular expressions into puns for amusement.

                  If it moves, compile it

                  B Offline
                  B Offline
                  Brisingr Aerowing
                  wrote on last edited by
                  #8

                  I am just trying to move this thread along, but it seems that it is not synchronizing.

                  All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

                  L 1 Reply Last reply
                  0
                  • L loctrice

                    Function SetDate(ByVal nYear As Long, ByVal nMonth As Long, ByVal nDay As Long, ByVal nHour As Long, ByVal nMinute As Long, ByVal nSecond As Long) As Date
                    Dim dTemp2 As New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
                    Return dTemp2
                    End Function

                    really? This is probably one of the best things this guy has done so far. I was advised not to put his code on this forum though. This one I just couldn't help.

                    If it moves, compile it

                    A Offline
                    A Offline
                    AspDotNetDev
                    wrote on last edited by
                    #9

                    It's obvious this guy added the SetDate implementation to a class that implements the IDateRepository in order to facilitate dependency injection and the factory pattern! All the better I say. Should minimize the impact of the Y3K bug and enable unit testing of date functionality against realistic data.

                    Thou mewling ill-breeding pignut!

                    1 Reply Last reply
                    0
                    • B Brisingr Aerowing

                      I am just trying to move this thread along, but it seems that it is not synchronizing.

                      All of the books in the world contain no more information than is broadcast as video in a single large American city in a single year. Not all bits have equal value. Carl Sagan

                      L Offline
                      L Offline
                      loctrice
                      wrote on last edited by
                      #10

                      I'm starting to see a pattern emerge here.

                      If it moves, compile it

                      1 Reply Last reply
                      0
                      • L loctrice

                        Function SetDate(ByVal nYear As Long, ByVal nMonth As Long, ByVal nDay As Long, ByVal nHour As Long, ByVal nMinute As Long, ByVal nSecond As Long) As Date
                        Dim dTemp2 As New Date(nYear, nMonth, nDay, nHour, nMinute, nSecond)
                        Return dTemp2
                        End Function

                        really? This is probably one of the best things this guy has done so far. I was advised not to put his code on this forum though. This one I just couldn't help.

                        If it moves, compile it

                        B Offline
                        B Offline
                        Bernhard Hiller
                        wrote on last edited by
                        #11

                        Let me guess: that guy used to work with VB6, and now he ports many "useful" functions from his year-long experience to VB.NET.

                        L 1 Reply Last reply
                        0
                        • B Bernhard Hiller

                          Let me guess: that guy used to work with VB6, and now he ports many "useful" functions from his year-long experience to VB.NET.

                          L Offline
                          L Offline
                          loctrice
                          wrote on last edited by
                          #12

                          Yes. He fought using .net in the first place, would not attempt to learn c#, and forces everything to work as if it were still vb6.

                          If it moves, compile it

                          R 1 Reply Last reply
                          0
                          • L loctrice

                            Yes. He fought using .net in the first place, would not attempt to learn c#, and forces everything to work as if it were still vb6.

                            If it moves, compile it

                            R Offline
                            R Offline
                            R Giskard Reventlov
                            wrote on last edited by
                            #13

                            Fire him! No Luddites allowed!!!

                            "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

                            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