thephpleague / period

PHP's time range API

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Instantiate from timestamp

blomdahldaniel opened this issue · comments

It would be a nice feature to also be able to instantiate a period using unix timestamps. Or is that problematic regarding which timezone that is present?

you can already do it

$period = new League\Period\Period('@1455052169', '@1455062169');

This is well explained in the documentation

Thank you! Where can I read about that in the docs?

omg.. Responded from my phone and did not see that link.

Any how, the docs miss this info. It should be an example under the heading Instantiation. So the syntax with the @ symbol should be precent and explained.. And when reading the fact that the

integer interpreted as the interval expressed in seconds.

still should be entered expressed as a string when creating the period is just weird, especially since there is no explanation or example for this in the docs.

So the syntax with the @ symbol should be precent and explained.

Why ? This is not an exotic syntax it is the syntax used by DateTime::construct

integer interpreted as the interval expressed in seconds.

This is only available for duration so I don't see any possible conflict, one syntax refers to a Timestamp the other to a duration.

Thank you! Only lack of understanding from my part.
Thank you for your time and explanations!