If you're developing an extension and you have a Title object
<https://doc.wikimedia.org/mediawiki-core/master/php/classMediaWiki_1_1Title_1_1Title.html>,
you can do:

use MediaWiki\MediaWikiServices;
$services = MediaWikiServices::getInstance();
$revision = $services->getRevisionLookup()->getFirstRevision( $title );
$timestamp = $revision->getTimestamp();

Bear in mind that the timestamp will be in MediaWiki format, see
Manual:Timestamp <https://www.mediawiki.org/wiki/Manual:Timestamp>.

On Thu, Dec 11, 2025 at 2:20 PM rtnF <[email protected]> wrote:

> Use rvdir=newer to get earliest revision.
>
> Example :
>
>
> https://en.wikipedia.org/w/api.php?action=query&prop=revisions&titles=OpenStreetMap&rvlimit=1&rvdir=newer&rvprop=timestamp|user&format=json
>
> On Fri, Dec 12, 2025, 12:03 AM encyc via Wikitech-l <
> [email protected]> wrote:
>
>> Good afternoon everyone and thank you for this list.
>>
>> I'm working on an extension (
>> https://www.mediawiki.org/wiki/Extension:RichResults) and need to know
>> the best way to get the article creation date (
>> https://schema.org/dateCreated), i.e. the first edit date. dateModified
>> was easy but dateCreated seems different. I understand it might mean
>> hitting the database. What's the best way to do this without slowing
>> performance? (version 1.44+) <https://schema.org/dateCreated>
>>
>> Flounder ceo
>> encyc
>>
>> Sent with Proton Mail <https://proton.me/mail/home> secure email.
>> _______________________________________________
>> Wikitech-l mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>>
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
> _______________________________________________
> Wikitech-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
_______________________________________________
Wikitech-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to