From a83a7def05ff0a42f0f3f8f926d3311e96ad8d39 Mon Sep 17 00:00:00 2001 From: JanHuang Date: Fri, 21 Apr 2017 23:03:36 +0800 Subject: [PATCH] dateObject::createFromTimestamp --- src/DateObject.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/DateObject.php b/src/DateObject.php index eb12219..3c89a5b 100644 --- a/src/DateObject.php +++ b/src/DateObject.php @@ -18,6 +18,15 @@ */ class DateObject extends DateTime { + /** + * @param $timestamp + * @return static + */ + public static function createFromTimestamp($timestamp) + { + return new static(date('Y-m-d H:i:s', $timestamp)); + } + /** * @return string */