#
source:
branches/feature-module-paygent/data/class/SC_Date.php
@
11689

Revision 11689, 2.4 KB checked in by uehara, 14 years ago (diff) |
---|

Line | |
---|---|

1 | <?php |

2 | /* |

3 | * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved. |

4 | * |

5 | * http://www.lockon.co.jp/ |

6 | */ |

7 | |

8 | /*¡¡Æü»þÉ½¼¨ÍÑ¥¯¥é¥¹ */ |

9 | class 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 getStartYear(){ |

26 | return $this->start_year; |

27 | } |

28 | |

29 | function setEndYear($endYear) { |

30 | $this->end_year = $endYear; |

31 | } |

32 | |

33 | function getEndYear() { |

34 | return $this->end_year; |

35 | } |

36 | |

37 | function setMonth($month){ |

38 | $this->month = $month; |

39 | } |

40 | |

41 | function setDay ($day){ |

42 | $this->day = $day; |

43 | } |

44 | |

45 | function getYear($year = '', $default = ''){ |

46 | if ( $year ) $this->setStartYear($year); |

47 | |

48 | $year = $this->start_year; |

49 | if ( ! $year ) $year = DATE("Y"); |

50 | |

51 | $end_year = $this->end_year; |

52 | if ( ! $end_year ) $end_year = (DATE("Y") + 3); |

53 | |

54 | $year_array = array(); |

55 | |

56 | for ($i=$year; $i<=($end_year); $i++){ |

57 | $year_array[$year] = $i; |

58 | if($year == $default) { |

59 | $year_array['----'] = "----"; |

60 | } |

61 | $year++; |

62 | } |

63 | return $year_array; |

64 | } |

65 | |

66 | function getZeroYear($year = ''){ |

67 | if ( $year ) $this->setStartYear($year); |

68 | |

69 | $year = $this->start_year; |

70 | if ( ! $year ) $year = DATE("Y"); |

71 | |

72 | $end_year = $this->end_year; |

73 | if ( ! $end_year ) $end_year = (DATE("Y") + 3); |

74 | |

75 | $year_array = array(); |

76 | |

77 | for ($i=$year; $i<=($end_year); $i++){ |

78 | $key = substr($i, -2); |

79 | $year_array[$key] = $key; |

80 | } |

81 | return $year_array; |

82 | } |

83 | |

84 | function getZeroMonth(){ |

85 | |

86 | $month_array = array(); |

87 | for ($i=1; $i <= 12; $i++){ |

88 | $val = sprintf("%02d", $i); |

89 | $month_array[$val] = $val; |

90 | } |

91 | return $month_array; |

92 | } |

93 | |

94 | |

95 | function getMonth(){ |

96 | |

97 | $month_array = array(); |

98 | for ($i=0; $i < 12; $i++){ |

99 | $month_array[$i + 1 ] = $i + 1; |

100 | } |

101 | return $month_array; |

102 | } |

103 | |

104 | function getDay(){ |

105 | |

106 | $day_array = array(); |

107 | for ($i=0; $i < 31; $i++){ |

108 | $day_array[ $i + 1 ] = $i + 1; |

109 | } |

110 | |

111 | return $day_array; |

112 | } |

113 | |

114 | function getHour(){ |

115 | |

116 | $day_array = array(); |

117 | for ($i=0; $i<=23; $i++){ |

118 | $hour_array[$i] = $i; |

119 | } |

120 | |

121 | return $hour_array; |

122 | } |

123 | |

124 | function getMinutes(){ |

125 | |

126 | $minutes_array = array(); |

127 | for ($i=0; $i<=59; $i++){ |

128 | $minutes_array[$i] = $i; |

129 | } |

130 | |

131 | return $minutes_array; |

132 | } |

133 | |

134 | function getMinutesInterval(){ |

135 | |

136 | $minutes_array = array("00"=>"00", "30"=>"30"); |

137 | return $minutes_array; |

138 | } |

139 | } |

140 | ?> |

**Note:**See TracBrowser for help on using the repository browser.