/
Slot.php
53 lines (47 loc) · 872 Bytes
/
Slot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
namespace Regitra;
class Slot
{
/**
* Date
*
* @var int
*/
protected $_date = 0;
/**
* Slot object
*
* @param int $year
* @param int $month
* @param int $day
* @param int $hour
* @param int $minute
*/
public function __construct($year, $month, $day, $hour, $minute = 0)
{
$this->_date = \mktime($hour, $minute, 0, $month, $day, $year);
}
/**
* Get date
*
* @param string $format
* @return string
*/
public function getDate($format = 'Y-m-d H:i')
{
return \date($format, $this->_date);
}
/**
* Get raw date (unix microtime)
*
* @return int
*/
public function getRawDate()
{
return $this->_date;
}
public function __toString()
{
return $this->getDate();
}
}