Changing date of many posts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Maxwell the Cat
    New Member
    • Oct 2008
    • 6

    Changing date of many posts?

    Is there a way to change the date/time of a lot of posts at once?
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    You would have to directly query the post table in the database. There is no front end for this.

    Comment

    • Maxwell the Cat
      New Member
      • Oct 2008
      • 6

      #3
      Originally posted by Jake Bunce
      You would have to directly query the post table in the database. There is no front end for this.
      I figured I would have to edit the SQL tables directly. What would the syntax for this look like?

      Comment

      • Lats
        Senior Member
        • Mar 2002
        • 3671

        #4
        What do you need to do exactly?
        Lats...

        Comment

        • Maxwell the Cat
          New Member
          • Oct 2008
          • 6

          #5
          Originally posted by Lats
          What do you need to do exactly?
          Basically, I set the date wrong on my forums. I caught it after a few days but now all the posts have the wrong date on them. I want to basically add three weeks to the date of all posts on my forums.

          I know I need to execute a SQL query to do this. Hopefully someone can help me out with the syntax for this.

          Comment

          • Lats
            Senior Member
            • Mar 2002
            • 3671

            #6
            The query would be...
            Code:
            UPDATE
               post
            SET
               dateline = dateline + 1814400
            Lats...

            Comment

            • Maxwell the Cat
              New Member
              • Oct 2008
              • 6

              #7
              Is the date field a number in seconds?

              Comment

              • Steve Machol
                Former Customer Support Manager
                • Jul 2000
                • 154488

                #8
                The dateline column in the post table is in Unix timestamp format, which is the number of seconds since midnight Jan. 1, 1970. You can use this online tool to convert Unix Timestamps to date and time:



                Just remember to enter in the GMT values for the server and not the date and time in your specific timezone.
                Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
                Change CKEditor Colors to Match Style (for 4.1.4 and above)

                Steve Machol Photography


                Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


                Comment

                • josef
                  Senior Member
                  • Dec 2004
                  • 105
                  • 3.5.x

                  #9
                  Originally posted by Lats
                  The query would be...
                  Code:
                  UPDATE
                     post
                  SET
                     dateline = dateline + 1814400

                  how to do that for specific posts based on date

                  means to change posts dated on xx/xx/xxxx to xx/xx/xxxx

                  ??

                  Comment

                  • Lats
                    Senior Member
                    • Mar 2002
                    • 3671

                    #10
                    You would add a where clause such as...
                    Code:
                    WHERE 
                     post.dateline > 1199145600
                    AND
                     post.dateline < 1230768000
                    Lats...

                    Comment

                    • josef
                      Senior Member
                      • Dec 2004
                      • 105
                      • 3.5.x

                      #11
                      i put

                      UPDATE
                      post
                      WHERE
                      post.dateline > 1231977600
                      AND
                      post.dateline < 1232063999
                      SET
                      dateline = dateline - 1231891200


                      but comes with error in syntax

                      Comment

                      • Lats
                        Senior Member
                        • Mar 2002
                        • 3671

                        #12
                        Try this...
                        Code:
                        UPDATE
                           post
                        SET
                           dateline = dateline - 1231891200
                        WHERE
                           post.dateline > 1231977600
                        AND
                           post.dateline < 1232063999
                        Lats...

                        Comment

                        • josef
                          Senior Member
                          • Dec 2004
                          • 105
                          • 3.5.x

                          #13
                          Originally posted by Lats
                          Try this...
                          Code:
                          UPDATE
                             post
                          SET
                             dateline = dateline - 1231891200
                          WHERE
                             post.dateline > 1231977600
                          AND
                             post.dateline < 1232063999

                          ok thats good

                          but is

                          dateline = dateline - 1231891200

                          correct to return one day for all posts ???

                          or what is the correct equation ??

                          Comment

                          • bigwater
                            Senior Member
                            • Jan 2007
                            • 592

                            #14
                            SET dateline = dateline - 1231891200 is never going to accomplish what you're trying to do. 1231891200 is 14258 days earlier than dateline, and as of now is approximately "the beggining of time" as far as unix goes... 39.06 years ago, or early January 1970. So you'd basically be subtracting 39 years from the current date.

                            If your need to adjust your timestamp back by exactly one day, it would be SET dateline - 86400. 86400 is the number of seconds in one day. If you need to go back several days, weeks, whatever... multiply 86400 x the number of days you want to go back and use that number.
                            Anybody who says "it can't be done" will usually be interrupted by somebody who is already doing it.

                            Comment

                            • josef
                              Senior Member
                              • Dec 2004
                              • 105
                              • 3.5.x

                              #15
                              what i need only to change the date ....not the time

                              i need to keep the time as it is and update only the date
                              Last edited by josef; Wed 14 Jan '09, 10:29pm.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...