• Resolved lawtai

    (@lawtai)


    I run a site for someone where they basically have 1 main post that they continuously update every week. I was wondering if it was possible to have the time stamp auto update itself everytime the post is saved when edited?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You can play around with this: $post->post_modified;

    I use it to display the date and time the page was edited.

    Within The Loop:

    date('format', $post->post_modified_gmt + date('Z'));

    That should do it I think. Not 100% sure.

    I use something like
    echo date(‘F jS, Y’, strtotime($post->post_modified))

    Mmm, that’s right, unless you use the MySQL conversion when doing the SELECT, it spits it out as the string still.

    However Beel, if the user’s blog time is different from the server time, you code won’t work. ??

    I’d say try:

    // Put this outside The Loop
    $offset = get_option('gmt_offset');

    // Put this inside The Loop
    echo date('format', strtotime($post->post_modified_gmt . ' GMT') + $offset*60);

    Right, fortunately the server time is the same – plus I am using it to display page update day and a few hours plus or minus t’ain’t important. I just want to know if it was last week or last month. ??

    For the anally challenged, I was just going to suggest using:
    $add_seconds = intval(3600 * get_settings(‘gmt_offset’));
    echo date(‘F jS, Y h:m a’, (strtotime($post->post_modified_gmt) + $add_seconds))

    We must have left lawtai in the dust.

    Thread Starter lawtai

    (@lawtai)

    lol sorry i was away for a few hours there. Thanks again for the help! I’ll give this a shot and see how it turns out.

    Thread Starter lawtai

    (@lawtai)

    thanks! it worked great

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Auto updating Timestamp?’ is closed to new replies.