-
Notifications
You must be signed in to change notification settings - Fork 0
/
Date.php
103 lines (83 loc) · 2.35 KB
/
Date.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
*
* SuperEmpreendedor para Magento
*
* @category SuperEmpreendedor
* @packages Base
* @copyright Copyright (c) 2014 SuperEmpreendedor (http://www.superempreendedor.com/pagseguro)
* @version 1.16.2
* @license http://www.superempreendedor.com/magento/licenca (Este arquivo é propriedade do SuperEmpreendedor e não pode ser copiado ou distribuÃdo sem autorização.)
*
*/
class Ideasa_Base_Date {
protected $day;
protected $month;
protected $year;
protected $hour;
protected $minute;
protected $second;
public function __construct($day, $month, $year, $hour, $minute, $second) {
$this->day = $day;
$this->month = $month;
$this->year = $year;
$this->hour = $hour;
$this->minute = $minute;
$this->second = $second;
}
public static function getInstanceFormatoAmericano($date){
$ano = substr($date, 0, 4);
$mes = substr($date, 5, 2);
$dia = substr($date, 8, 2);
$hora = substr($date, 11, 2);
$minuto = substr($date, 14, 2);
$segundo = substr($date, 17, 2);
if(Ideasa_Base_Helper_StringUtils::isEmpty($hora)){
$hora = 0;
}
if(Ideasa_Base_Helper_StringUtils::isEmpty($minuto)){
$minuto = 0;
}
if(Ideasa_Base_Helper_StringUtils::isEmpty($segundo)){
$segundo = 0;
}
return new Ideasa_Base_Date($dia, $mes, $ano, $hora, $minuto, $segundo);
}
public function setDay($day) {
$this->day = $day;
}
public function getDay() {
return $this->day;
}
public function setMonth($month) {
$this->month = $month;
}
public function getMonth() {
return $this->month;
}
public function setYear($year) {
$this->year = $year;
}
public function getYear() {
return $this->year;
}
public function setHour($hour) {
$this->hour = $hour;
}
public function getHour() {
return $this->hour;
}
public function setMinute($minute) {
$this->minute = $minute;
}
public function getMinute() {
return $this->minute;
}
public function setSecond($second) {
$this->second = $second;
}
public function getSecond() {
return $this->second;
}
}
?>