source: branches/comu/data/class/SC_Date.php @ 2

Revision 2, 2.3 KB checked in by root, 17 years ago (diff)

new import

Line 
1<?php
2/*
3 * Copyright(c) 2000-2006 LOCKON CO.,LTD. All Rights Reserved.
4 *
5 * http://www.lockon.co.jp/
6 */
7
8/*¡¡Æü»þɽ¼¨ÍÑ¥¯¥é¥¹ */
9class SC_Date {
10    var $start_year;
11    var $month;
12    var $day;
13    var $end_year;
14   
15    // ¥³¥ó¥¹¥È¥é¥¯¥¿
16    function SC_Date($start_year='', $end_year='') {
17        if ( $start_year )  $this->setStartYear($start_year);   
18        if ( $end_year )    $this->setEndYear($end_year);
19    }
20   
21    function setStartYear($year){
22        $this->start_year = $year;
23    }
24
25    function setEndYear($endYear) {
26        $this->end_year = $endYear;
27    }
28   
29    function setMonth($month){
30        $this->month = $month;         
31    }
32   
33    function setDay ($day){
34        $this->day = $day;
35    }
36           
37    function getYear($year = '', $default = ''){
38        if ( $year ) $this->setStartYear($year);
39       
40        $year = $this->start_year;
41        if ( ! $year ) $year = DATE("Y");
42       
43        $end_year = $this->end_year;
44        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
45       
46        $year_array = array();
47       
48        for ($i=$year; $i<=($end_year); $i++){     
49            $year_array[$year] = $i;
50            if($year == $default) {
51                $year_array['----'] = "----";
52            }
53            $year++;
54        }
55        return $year_array;
56    }
57   
58    function getZeroYear($year = ''){
59        if ( $year ) $this->setStartYear($year);
60       
61        $year = $this->start_year;
62        if ( ! $year ) $year = DATE("Y");
63       
64        $end_year = $this->end_year;
65        if ( ! $end_year ) $end_year = (DATE("Y") + 3);
66       
67        $year_array = array();
68       
69        for ($i=$year; $i<=($end_year); $i++){
70            $key = substr($i, -2);
71            $year_array[$key] = $key;
72        }
73        return $year_array;
74    }
75   
76    function getZeroMonth(){
77   
78        $month_array = array();
79        for ($i=1; $i <= 12; $i++){
80            $val = sprintf("%02d", $i);
81            $month_array[$val] = $val;
82        }
83        return $month_array;
84    }   
85   
86   
87    function getMonth(){
88   
89        $month_array = array();
90        for ($i=0; $i < 12; $i++){     
91            $month_array[$i + 1 ] = $i + 1;
92        }
93        return $month_array;
94    }   
95   
96    function getDay(){ 
97       
98        $day_array = array();
99        for ($i=0; $i < 31; $i++){     
100            $day_array[ $i + 1 ] = $i + 1;
101        }
102       
103        return $day_array;
104    }
105
106    function getHour(){
107       
108        $day_array = array();
109        for ($i=0; $i<=23; $i++){       
110            $hour_array[$i] = $i;
111        }
112       
113        return $hour_array;
114    }
115
116    function getMinutes(){ 
117       
118        $minutes_array = array();
119        for ($i=0; $i<=59; $i++){       
120            $minutes_array[$i] = $i;
121        }
122       
123        return $minutes_array;
124    }
125   
126    function getMinutesInterval(){ 
127       
128        $minutes_array = array("00"=>"00", "30"=>"30");     
129        return $minutes_array;
130    }   
131}
132?>
Note: See TracBrowser for help on using the repository browser.