-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDateInterface.php
More file actions
109 lines (102 loc) · 2.59 KB
/
DateInterface.php
File metadata and controls
109 lines (102 loc) · 2.59 KB
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
104
105
106
107
108
109
<?php
/**
* Date Interface
*
* @package Controller
* @copyright 2014 Amy Stephen. All rights reserved.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
*/
namespace CommonApi\Application;
/**
* Date Interface
*
* @package Controller
* @copyright 2014 Amy Stephen. All rights reserved.
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @since 1.0
*/
interface DateInterface
{
/**
* Prepares Date object
*
* @param string $time
* @param null $timezone
* @param string $server_or_user_timezone
* @param string $date_format
*
* @return string
* @since 1.0.0
*/
public function getDate(
$time = 'now',
$timezone = null,
$server_or_user_timezone = 'user',
$date_format = 'Y-m-d H:i:s'
);
/**
* Converts standard MYSQL date (ex. 2011-11-11 11:11:11) to CCYY-MM-DD format (ex. 2011-11-11)
*
* @param string $date
*
* @return string CCYY-MM-DD
* @since 1.0.0
*/
public function convertCCYYMMDD($date = null);
/**
* Get the number of days between two dates
*
* @param string $date1 Expressed as CCYY-MM-DD
* @param string $date2 Expressed as CCYY-MM-DD
*
* @since 1.0.0
* @return integer
*/
public function getNumberofDaysAgo($date1, $date2 = null);
/**
* Get Pretty Date
*
* @param string $date
* @param string $compare_to_date
*
* @return string
* @since 1.0.0
*/
public function getPrettyDate($date, $compare_to_date = null);
/**
* Provides translated name of day in abbreviated or full format, given day number
*
* @param string $day_number
* @param bool $abbreviation
*
* @return string
* @since 1.0.0
*/
public function getDayName($day_number, $abbreviation = false);
/**
* Provides translated name of month in abbreviated or full format, given month number
*
* @param string $month_number
* @param bool $abbreviation
*
* @return string
* @since 1.0.0
*/
public function getMonthName($month_number, $abbreviation = false);
/**
* buildCalendar
*
* $d = getDate();
* $month = $d['mon'];
* $year = $d['year'];
*
* $calendar = $this->date->buildCalendar ($month, $year);
*
* @param string $month
* @param string $year
*
* @return array
* @since 1.0.0
*/
public function buildCalendar($month, $year);
}