Jump to content

Recommended Posts

Hi PHP expert, I am trying to read the post date from my tumblr api with the following code.

 

$date = $xml->posts->post ['date'];

 

echo '<p>'.$date.'</p>';

 

This is what I get from the above code "Wed, 21 Nov 2012 13:32:00"

 

My question is, are there anyways I can get the date with out the hour, min and seconds? for example "Wed,21 Nov 2012"?

Link to comment
https://forums.phpfreaks.com/topic/273211-trying-to-read-date-from-tumblr-api/
Share on other sites

Thanks for the reply, with the above code will only show the local date. what I am trying to do is the pull the date from a Tumblr XML API as below.

 

<posts start="1" total="77">

<post id="38470857535" url="http://myblog.tumblr.com/post/38470857535" url-with-slug="http://myblogblog.tumblr.com/post/38470857535" type="photo"date-gmt="2012-12-21 16:38:51 GMT" date="Fri, 21 Dec 2012 11:38:51" unix-timestamp="1356107931" format="html" reblog-key="3ZWYJfgn" slug="" width="1064">

 

 

And I used the code below to call it:

 

<?php

$request_url = "http://myblog.tumblr.com/api/read?start=0&num=1";

$xml = simplexml_load_file($request_url);

 

$date = $xml->posts->post ['date'];

 

in order to get the posting date I need to "= $xml->posts->post ['date'];" so is there anyway to do something like = $xml->posts->post ['date'("D, d M Y", strtotime($date)];

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.