1

I have the following date and time in an RSS feed:

Fri, 01 Oct 2010 12:26:57 +0000

However I just want to display:

Fri, 01 Oct 2010 12:26:57

There should be a really simple way to do this in PHP, right?

2

2 Answers 2

5

If you don't mind showing the date in UTC/GMT (I forget which), then just use substring to strip off the +0000. However, if you want local time, you'll have to convert the string to a timestamp and then format the timestamp back to a date string.

$uncleandate = 'Fri, 01 Oct 2010 12:26:57 +0000';
$timestamp = strtotime($uncleandate);
$cleandate = date('D, d M Y H:i:s', $timestamp);
Sign up to request clarification or add additional context in comments.

Comments

0

$clean_string = str_replace(" +0000", "", $your_date_string); should do the job

see str_replace doc

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.