Date Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • F@yy@Z

    Date Problem

    Hi

    I have one field in SQL Database datatype as datetime. When I am inserting
    or updating using asp on my machine its working fine but when I installed DB
    and application on other server and try to insert or update date using asp
    it giving error of date convertion.

    I know that its date format problem on one server it accept only
    "24/07/2004" format but on second server it accept as "07/24/2004" .

    As I don't know what will be date format on client server so this will be a
    problem.

    I am sure some of you have faced this problem and solved this, Please advise
    me how I can solve it what is the best way.

    Kind Regards




  • John

    #2
    Re: Date Problem




    Comment

    • John

      #3
      Re: Date Problem

      Use different boxes for D, M and Y
      see ex. on http://www.tenerife-dolphins-whales.com/booking.asp


      Comment

      • F@yy@Z

        #4
        Re: Date Problem

        Thanks for your reply
        I tried the method described on http://www.aspfaq.com/show.asp?id=2023 link
        It giving me error when I am using date as "20040724" but there is no error
        when using "2004-07-24".

        As I am using only SQL server it should work according to this article
        inserting date as "20040724" but its not.

        its giving following error

        "Microsoft OLE DB Provider for SQL Server (0x80040E07)
        The conversion of a char data type to a datetime data type resulted in an
        out-of-range datetime value."


        I tried

        "John" <n o b o d y@spam.com> wrote in message
        news:LPbLc.1900 94$xB.9264239@p hobos.telenet-ops.be...[color=blue]
        > Use different boxes for D, M and Y
        > see ex. on http://www.tenerife-dolphins-whales.com/booking.asp
        >
        >[/color]


        Comment

        • Aaron [SQL Server MVP]

          #5
          Re: Date Problem

          Can you show the actual statement that causes this error, and the structure
          of the table you are inserting into...

          --

          (Reverse address to reply.)




          "F@yy@Z" <fayyaz.ahmed@m vwebmaker.com> wrote in message
          news:#M7OhwnbEH A.4032@TK2MSFTN GP11.phx.gbl...[color=blue]
          > Thanks for your reply
          > I tried the method described on http://www.aspfaq.com/show.asp?id=2023[/color]
          link[color=blue]
          > It giving me error when I am using date as "20040724" but there is no[/color]
          error[color=blue]
          > when using "2004-07-24".
          >
          > As I am using only SQL server it should work according to this article
          > inserting date as "20040724" but its not.
          >
          > its giving following error
          >
          > "Microsoft OLE DB Provider for SQL Server (0x80040E07)
          > The conversion of a char data type to a datetime data type resulted in an
          > out-of-range datetime value."
          >
          >
          > I tried
          >
          > "John" <n o b o d y@spam.com> wrote in message
          > news:LPbLc.1900 94$xB.9264239@p hobos.telenet-ops.be...[color=green]
          > > Use different boxes for D, M and Y
          > > see ex. on http://www.tenerife-dolphins-whales.com/booking.asp
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • F@yy@Z

            #6
            Re: Date Problem

            Here is sql and Table format

            INSERT INTO Semester (Semester_Name, Semester_Start, Semester_End,
            Course_id)VALUE S ('test','200420 07','20042207', 'asdsa')


            3 Semester_ID numeric 9 0
            0 Semester_Name nvarchar 30 0
            0 Semester_Start datetime 8 0
            0 Semester_End datetime 8 0
            0 Course_id nvarchar 10 1

            Regards




            "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
            news:O3mocynbEH A.3752@TK2MSFTN GP12.phx.gbl...[color=blue]
            > Can you show the actual statement that causes this error, and the[/color]
            structure[color=blue]
            > of the table you are inserting into...
            >
            > --
            > http://www.aspfaq.com/
            > (Reverse address to reply.)
            >
            >
            >
            >
            > "F@yy@Z" <fayyaz.ahmed@m vwebmaker.com> wrote in message
            > news:#M7OhwnbEH A.4032@TK2MSFTN GP11.phx.gbl...[color=green]
            > > Thanks for your reply
            > > I tried the method described on http://www.aspfaq.com/show.asp?id=2023[/color]
            > link[color=green]
            > > It giving me error when I am using date as "20040724" but there is no[/color]
            > error[color=green]
            > > when using "2004-07-24".
            > >
            > > As I am using only SQL server it should work according to this article
            > > inserting date as "20040724" but its not.
            > >
            > > its giving following error
            > >
            > > "Microsoft OLE DB Provider for SQL Server (0x80040E07)
            > > The conversion of a char data type to a datetime data type resulted in[/color][/color]
            an[color=blue][color=green]
            > > out-of-range datetime value."
            > >
            > >
            > > I tried
            > >
            > > "John" <n o b o d y@spam.com> wrote in message
            > > news:LPbLc.1900 94$xB.9264239@p hobos.telenet-ops.be...[color=darkred]
            > > > Use different boxes for D, M and Y
            > > > see ex. on http://www.tenerife-dolphins-whales.com/booking.asp
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • F@yy@Z

              #7
              Re: Date Problem

              Sorry I relize the mistake

              INSERT INTO Semester (Semester_Name, Semester_Start, Semester_End,
              Course_id)VALUE S ('test','200420 07','20042207', 'asdsa')

              it should like "20040720"

              Soryy about this again



              "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
              news:O3mocynbEH A.3752@TK2MSFTN GP12.phx.gbl...[color=blue]
              > Can you show the actual statement that causes this error, and the[/color]
              structure[color=blue]
              > of the table you are inserting into...
              >
              > --
              > http://www.aspfaq.com/
              > (Reverse address to reply.)
              >
              >
              >
              >
              > "F@yy@Z" <fayyaz.ahmed@m vwebmaker.com> wrote in message
              > news:#M7OhwnbEH A.4032@TK2MSFTN GP11.phx.gbl...[color=green]
              > > Thanks for your reply
              > > I tried the method described on http://www.aspfaq.com/show.asp?id=2023[/color]
              > link[color=green]
              > > It giving me error when I am using date as "20040724" but there is no[/color]
              > error[color=green]
              > > when using "2004-07-24".
              > >
              > > As I am using only SQL server it should work according to this article
              > > inserting date as "20040724" but its not.
              > >
              > > its giving following error
              > >
              > > "Microsoft OLE DB Provider for SQL Server (0x80040E07)
              > > The conversion of a char data type to a datetime data type resulted in[/color][/color]
              an[color=blue][color=green]
              > > out-of-range datetime value."
              > >
              > >
              > > I tried
              > >
              > > "John" <n o b o d y@spam.com> wrote in message
              > > news:LPbLc.1900 94$xB.9264239@p hobos.telenet-ops.be...[color=darkred]
              > > > Use different boxes for D, M and Y
              > > > see ex. on http://www.tenerife-dolphins-whales.com/booking.asp
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • Aaron [SQL Server MVP]

                #8
                Re: Date Problem

                There is no 20th or 22nd month. You created YYYYDDMM strings, not YYYYMMDD
                strings.

                --

                (Reverse address to reply.)




                "F@yy@Z" <fayyaz.ahmed@m vwebmaker.com> wrote in message
                news:OaAC$7nbEH A.4092@TK2MSFTN GP11.phx.gbl...[color=blue]
                > Here is sql and Table format
                >
                > INSERT INTO Semester (Semester_Name, Semester_Start, Semester_End,
                > Course_id)VALUE S ('test','200420 07','20042207', 'asdsa')
                >
                >
                > 3 Semester_ID numeric 9 0
                > 0 Semester_Name nvarchar 30 0
                > 0 Semester_Start datetime 8 0
                > 0 Semester_End datetime 8 0
                > 0 Course_id nvarchar 10 1
                >
                > Regards
                >
                >
                >
                >
                > "Aaron [SQL Server MVP]" <ten.xoc@dnartr eb.noraa> wrote in message
                > news:O3mocynbEH A.3752@TK2MSFTN GP12.phx.gbl...[color=green]
                > > Can you show the actual statement that causes this error, and the[/color]
                > structure[color=green]
                > > of the table you are inserting into...
                > >
                > > --
                > > http://www.aspfaq.com/
                > > (Reverse address to reply.)
                > >
                > >
                > >
                > >
                > > "F@yy@Z" <fayyaz.ahmed@m vwebmaker.com> wrote in message
                > > news:#M7OhwnbEH A.4032@TK2MSFTN GP11.phx.gbl...[color=darkred]
                > > > Thanks for your reply
                > > > I tried the method described on http://www.aspfaq.com/show.asp?id=2023[/color]
                > > link[color=darkred]
                > > > It giving me error when I am using date as "20040724" but there is no[/color]
                > > error[color=darkred]
                > > > when using "2004-07-24".
                > > >
                > > > As I am using only SQL server it should work according to this article
                > > > inserting date as "20040724" but its not.
                > > >
                > > > its giving following error
                > > >
                > > > "Microsoft OLE DB Provider for SQL Server (0x80040E07)
                > > > The conversion of a char data type to a datetime data type resulted in[/color][/color]
                > an[color=green][color=darkred]
                > > > out-of-range datetime value."
                > > >
                > > >
                > > > I tried
                > > >
                > > > "John" <n o b o d y@spam.com> wrote in message
                > > > news:LPbLc.1900 94$xB.9264239@p hobos.telenet-ops.be...
                > > > > Use different boxes for D, M and Y
                > > > > see ex. on http://www.tenerife-dolphins-whales.com/booking.asp
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                Working...