Detailed Datestamp Display Option AND timestamp on posts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rodney B
    Member
    • Jan 2005
    • 59
    • 3.7.x

    Detailed Datestamp Display Option AND timestamp on posts

    Is there a way to use the DETAILED "Datestamp Display Option" AND have a timestamp on each post in a thread?

    I like the way the detailed looks and reads, but it would be nice to have a timestamp next to each post somewhere.

    Is there a language or function that I can put in the template to show the timestamp for a post?
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    Edit this template:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Postbit Templates -> postbit or postbit_legacy (depending on which layout you are using)

    Use this variable to display the timestamp:

    Code:
    $post[dateline]

    Comment

    • Rodney B
      Member
      • Jan 2005
      • 59
      • 3.7.x

      #3
      Thanks Jake (and thanks for showing me which template).

      But when I put that code in there, it shows this type time: 1168392462

      Comment

      • Andy Huang
        Senior Member
        • Feb 2004
        • 4602

        #4
        Yes, that is the timestamp of the post, down to exact seconds.
        You can use this conversion tool to get the actual time.
        Best Regards,
        Andy Huang

        Comment

        • Rodney B
          Member
          • Jan 2005
          • 59
          • 3.7.x

          #5
          Thanks Andy, but how do I use that conversion tool on my website so that vbulletin shows a "regular" timestamp next to the post? Like 1:41:03 pm?

          Comment

          • Andy Huang
            Senior Member
            • Feb 2004
            • 4602

            #6
            Edit the template; use a fake conditional template to convert it using one of php's date functions, and then display it.

            For example:
            Code:
            <if condition="$parsed_timestamp = date('l dS \of F Y h:i:s A', $post[dateline]);></if>
            $parsed_timestamp
            That should give you something like: Monday 15th of August 2005 03:12:46 PM.
            Best Regards,
            Andy Huang

            Comment

            • Rodney B
              Member
              • Jan 2005
              • 59
              • 3.7.x

              #7
              I don't think vbulletin liked the fake conditional. I got this error:

              Code:
                       The following template conditional expression contains function calls:
              
                                  <if condition="$parsed_timestamp = date('l dS \of F Y h:i:s A', $post[dateline]);></if> $parsed_timestamp             $post[firstnewinsert]             <!-- / status icon and date -->                         </td>         <td class="thead" style="font-weight:normal" align="$stylevar[right]">
              
                                                                                Function Name                         Usage in Expression                     datedate(\'l dS \\of F Y h:i:s A\', $post[dateline])                                           
              With a few exceptions, function calls are not permitted in template conditional expressions. Please go back and re-write this expression.
              
              The following functions are allowed in template conditional expressions:
                                  in_array() is_array() is_numeric() isset() empty() defined() array() can_moderate() can_moderate_calendar() exec_switch_bg() is_browser() is_member_of()

              Comment

              • Andy Huang
                Senior Member
                • Feb 2004
                • 4602

                #8
                Ah, bummer, I forgot about that restriction...
                I guess it'd need to use a plugin for this because template engine doesn't like the date function being called....

                Here's a quickie:
                Add a new plugin via Plugin section in Admin CP; give it code:
                Code:
                $post[parsed_stamp] = date('l dS \of F Y h:i:s A', $post[dateline]);
                And assign it to execute at vBulletin: Show Thread / showthread_postbit_create
                Execution order doesn't matter.

                Save it.

                Then go to your postbit / postbit_legacy (depending on one you're using) and add at where you want it to appear:
                Code:
                $post[parsed_stamp]
                I've got it working on mine end
                Best Regards,
                Andy Huang

                Comment

                • Rodney B
                  Member
                  • Jan 2005
                  • 59
                  • 3.7.x

                  #9
                  Thanks Andy, that worked perfectly! Thanks for taking the time out to help...I really appreciate it.

                  Comment

                  • Rodney B
                    Member
                    • Jan 2005
                    • 59
                    • 3.7.x

                    #10
                    Ok, I've got another related question

                    At the moment the timestamp shows server time rather than local time (as set by the users in their control panel).

                    Is there a way to get it to show local time rather than server time?

                    Comment

                    • Andy Huang
                      Senior Member
                      • Feb 2004
                      • 4602

                      #11
                      Try this (I don't know if it will work as I can't access my test forum right now due to network issue):

                      the code I gave you had:
                      Code:
                      date(.....
                      replace it with:
                      Code:
                      vbdate(.....
                      Best Regards,
                      Andy Huang

                      Comment

                      • Rodney B
                        Member
                        • Jan 2005
                        • 59
                        • 3.7.x

                        #12
                        Andy...you are officially "THE MAN". Thanks...that worked perfectly! Where's that paypal donate button when you need it?

                        Thanks again!

                        Comment

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