0

Hi there,

I have an RSS feed generated by a php script and I need the published date to show but no the time. For some reason my tiny little brain cannot get the code to work without showing everything.

Please can someone help as I am slowly going insane.

The script is:

$dd = substr($d_var['weekday'],0,3) .','. $d_var[mday] .' '.substr($d_var[month],0,3).' '. $d_var[year] .' 09:00:00 GMT';

Thanks in advance.

Facte

5
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by FlashCreations
0

post your required date format.
e.g. default you have $date = '2010-12-31 10:00:00';
Now in what format you would like to display?

0

post your required date format.
e.g. default you have $date = '2010-12-31 10:00:00';
Now in what format you would like to display?

Thanks for the reply.

Date bit is fine so currently it shows Day then date then time. I just want to get rid of the time.

0

well just use substr when you output it,
$date = substr($input, 10);
there will always be the same number of characters in the date, so this is probably the simplest "one liner"

0

To be absolutely sure, you could split the string into the date and time part with explode() :

//Split it and eliminate the time
list($date,) = explode(' ', $date);
//Show the result
echo $date;

On the off change that the date format does not add leading zeros to one digit months/days (I believe the standard does), this would be one way around that and would still work with two digit months and/or days.

0

then just get rid of the last part where you are appending the time: $dd = substr($d_var['weekday'],0,3) .','. $d_var[mday] .' '.substr($d_var[month],0,3).' '. $d_var[year];

Edited by hielo: typo

0

then just get rid of the last part where you are appending the time: $dd = substr($d_var['weekday'],0,3) .','. $d_var[mday] .' '.substr($d_var[month],0,3).' '. $d_var[year];

That was my first thought, but then I assumed the solution wasn't as simple as that. I don't know though, it might be. In which case, we all would look like total idiots for making it so difficult. :P

Edited by FlashCreations: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.