Cody Raspien Cody Raspien - 11 days ago 4
PHP Question

Today's date format - Day (Shorthand) Date Number Month (Shorthand) - PHP

I have a feed which gives feed in the following format: "Fri 14 Oct"

I want to see if today's date matches the date from the feed. My problem is the format of today's date/

$today = date("d m");

This outputs 17 10.

What is the best way to format $today so that it outputs Day (shorthand) space date (number) Month (shorthand) ?


how about:

$today = date("D j M");

As explained in date() reference manual.

Anyway you should be aware of timezone issues unless you are 100% sure that your server is in the same timezone of the feed you are comparing.

I would follow a different approach though, you can parse the feed's date using DateTime::createFromFormat() which also understand timezones, and then compare it with today's date.