1 | <?php |
||
15 | class DateTimeFactory |
||
16 | { |
||
17 | /** |
||
18 | * Create a @see \Andegna\DateTime representing now. |
||
19 | * |
||
20 | * @param DateTimeZone|null $dateTimeZone the timezone |
||
21 | * |
||
22 | * @return DateTime the datetime u wanted |
||
23 | */ |
||
24 | 1 | public static function now(DateTimeZone $dateTimeZone = null) |
|
32 | |||
33 | /** |
||
34 | * @param DateTimeZone|null $dateTimeZone the timezone |
||
35 | * |
||
36 | * @return DateTimeZone a valid timezone |
||
37 | */ |
||
38 | 49 | protected static function checkForDateTimeZone(DateTimeZone $dateTimeZone = null) |
|
47 | |||
48 | /** |
||
49 | * Create a @see \Andegna\DateTime of year month day ... |
||
50 | * |
||
51 | * @param int $year ethiopian year |
||
52 | * @param int $month ethiopian month |
||
53 | * @param int $day ethiopian day |
||
54 | * @param int $hour hour |
||
55 | * @param int $minute minute |
||
56 | * @param int $second second |
||
57 | * @param DateTimeZone|null $dateTimeZone the timezone |
||
58 | * |
||
59 | * @return DateTime the datetime u wanted |
||
60 | */ |
||
61 | 49 | public static function of($year, $month, $day, |
|
81 | |||
82 | /** |
||
83 | * @param int $timestamp timestamp like @see time() |
||
84 | * @param DateTimeZone|null $dateTimeZone the timezone |
||
85 | * |
||
86 | * @return DateTime the datetime u wanted |
||
87 | */ |
||
88 | 1 | public static function fromTimestamp($timestamp, DateTimeZone $dateTimeZone = null) |
|
97 | |||
98 | /** |
||
99 | * Just for convenience. |
||
100 | * |
||
101 | * @param GregorianDateTime $gregorian |
||
102 | * |
||
103 | * @return DateTime the datetime u wanted |
||
104 | */ |
||
105 | 1 | public static function fromDateTime(GregorianDateTime $gregorian) |
|
109 | |||
110 | /** |
||
111 | * Just for convenience. |
||
112 | * |
||
113 | * @param Converter $con |
||
114 | * @param DateTimeZone|null $dateTimeZone |
||
115 | * |
||
116 | * @return DateTime the datetime u wanted |
||
117 | */ |
||
118 | 1 | public static function fromConverter(Converter $con, DateTimeZone $dateTimeZone = null) |
|
125 | } |
||
126 |