Jump to content

How to retrieve the date that database item is published and updated

Featured Replies

Posted

On custom database template, date is parsed by:

{datetime="$record->record_publish_date"}

Which results in:

<time datetime="2013-09-21T03:42:47Z" title="09/21/2013 12:42  AM" data-short="Sep 13">21 Sep 2013</time>

I want to retrieve only the straight date of publishing and updating in this format:

2009-05-08

It's for micro data purposes.

Anyone can help? Thanks.

  • Author

Anyone?

{datetime="$record->record_publish_date"|raw}

try this

  • Author

It gives something like this:

1408594320

But how to get like this:

2009-05-08

 

  • Author

Almost there! Now it gives:

 

08/21/2014

 

  • Community Expert

If you want a custom date output in just one place, you would need to run the Unix timestamp (e.g. “1408594320”) through PHP’s date function. 

http://php.net/manual/en/function.date.php

  • Author

Thanks!

and how to get the updated date?

  • Author

Works great:

{{$datePublished = date ("Y-m-d", $record->record_publish_date);}}
          <meta itemprop="datePublished" content="{$datePublished}">

What about date updated?

  • Community Expert

Those are all the date fields:

  • record_publish_date
  • record_saved
  • record_updated
  • record_last_comment
  • record_last_review
  • record_edit_time
  • Author

Thanks!! Is there any documantation about?

  • Community Expert

I looked it up in phpMyAdmin. It’s just the names of the actual database columns. 

  • Author

Perfect!

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.