Provide support for obtaining a week number of year (week starts on Sunday)
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

date_get_week_number() for PHP

Build Status

According to the documentation for date function of the W format character

ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)

date_get_week_number amends this issue by retuning a week number of a year where the week starts on Sunday

Requirements

PHP >= 5.2.0 because of the DateTime object usage

Usage

$date = new \DateTime;
$week = \date_get_week_number($date);

Installation

Via composer:

{
    "require": {
        "dv-affection/date_get_week_number": "~0.1"
    }
}

Tests

cd date_get_week_number; phpunit;

...
OK (2 tests, 3 assertions)