thephpleague / period

PHP's time range API

Home Page:https://period.thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Named constructors with strings or date object ?

kursusHC opened this issue · comments

Hello and thanks for your nice project.

I have an array of dates like

$dates = array( '2012-04-01 08:30:00', '2015-12-28 10:25:00', '2015-11-17 03:17:00' ...);

Basically I would need to group all these dates by "regular" periods (say months).

Is there any way to do something like this :

Period::createFromMonth('2015-11');

Edit : I know I can parse the date string but just ask for sake of simplicity :)

Thanks !

Well getDatePeriod is what I was looking for. Sorry for bothering !