Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezxmlrpcdatetime.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: ezxmlrpcdatetime.php 2835 2001-01-25 09:23:53Z bf $
5 //
6 // Definition of eZXMLRPCDateTime class
7 //
8 // B�rd Farstad <bf@ez.no>
9 // Created on: <17-Dec-2000 17:28:13 bf>
10 //
11 // This source file is part of Exponential Basic, publishing software.
12 // Copyright (C) 1999-2000 eZ systems as
13 //
14 // This program is free software; you can redistribute it and/or
15 // modify it under the terms of the GNU General Public License
16 // as published by the Free Software Foundation; either version 2
17 // of the License, or (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
27 //
28
29
32
36 class eZXMLRPCDatetime
37 {
43 function __construct( $year=0, $month=0, $day=0, $hour=0, $minute=0, $second=0 )
44 {
45 if ( ( $year == 0 ) && ( $month == 0 ) && ( $day == 0 ) && ( $hour == 0 ) && ( $minute == 0 ) && ( $second == 0 ) )
46 {
47 $now = getdate();
48 $this->Year = $now[ "year" ];
49 $this->Month = $now[ "mon" ];
50 $this->Day = $now[ "mday" ];
51 $this->Hour = $now[ "hours" ];
52 $this->Minute = $now[ "minutes" ];
53 $this->Second = $now[ "seconds" ];
54 }
55 else
56 {
57 $this->setYear( $year );
58 $this->setMonth( $month );
59 $this->setDay( $day );
60 $this->setHour( $hour );
61 $this->setMinute( $minute );
62 $this->setSecond( $second );
63 }
64 }
65
69 function &serialize( )
70 {
71 $year = $this->year();
72 $month = $this->addZero( $this->month() );
73 $day = $this->addZero( $this->day() );
74
75 $hour = $this->addZero( $this->hour() );
76 $minute = $this->addZero( $this->minute() );
77 $second = $this->addZero( $this->second() );
78
79 $value = $year . $month . $day . "T" . $hour . ":" . $minute . ":" . $second;
80
81 $ret = "<value>";
82 $ret .= "<dateTime.iso8601>";
83 $ret .= $value;
84 $ret .= "</dateTime.iso8601>";
85 $ret .= "</value>";
86
87 return $ret;
88 }
89
95 function value()
96 {
97 $year = $this->year();
98 $month = $this->addZero( $this->month() );
99 $day = $this->addZero( $this->day() );
100
101 $hour = $this->addZero( $this->hour() );
102 $minute = $this->addZero( $this->minute() );
103 $second = $this->addZero( $this->second() );
104
105 $value = $year . "-" . $month . "-" . $day . " " . $hour . ":" . $minute . ":" . $second;
106
107 return $value;
108 }
109
113 function year()
114 {
115 return $this->Year;
116 }
117
121 function month()
122 {
123 return $this->Month;
124 }
125
129 function day()
130 {
131 return $this->Day;
132 }
133
137 function hour()
138 {
139 return $this->Hour;
140 }
141
145 function minute()
146 {
147 return $this->Minute;
148 }
149
150
154 function second()
155 {
156 return $this->Second;
157 }
158
159
163 function setYear( $value )
164 {
165 $this->Year = $value;
166 setType( $this->Year, "integer" );
167 }
168
172 function setMonth( $value )
173 {
174 $this->Month = $value;
175 setType( $this->Month, "integer" );
176 }
177
181 function setDay( $value )
182 {
183 $this->Day = $value;
184 setType( $this->Day, "integer" );
185 }
186
190 function setHour( $value )
191 {
192 $this->Hour = $value;
193 setType( $this->Hour, "integer" );
194 }
195
199 function setMinute( $value )
200 {
201 $this->Minute = $value;
202 setType( $this->Minute, "integer" );
203 }
204
208 function setSecond( $value )
209 {
210 $this->Second = $value;
211 setType( $this->Second, "integer" );
212 }
213
214
218 function decode( $value )
219 {
220 if ( ereg( "([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})", $value, $valueArray ) )
221 {
222 $this->setYear( $valueArray[1] );
223 $this->setMonth( $valueArray[2] );
224 $this->setDay( $valueArray[3] );
225 $this->setHour( $valueArray[4] );
226 $this->setMinute( $valueArray[5] );
227 $this->setSecond( $valueArray[6] );
228 }
229 }
230
235 function addZero( $value )
236 {
237 $ret = $value;
238 if ( $ret < 10 )
239 {
240 $ret = "0". $ret;
241 }
242
243 return $ret;
244 }
245
246
247 var $Year;
248 var $Month;
249 var $Day;
250 var $Hour;
251 var $Minute;
252 var $Second;
253
254 }
255
256 ?>
$day
else $day
Definition: appointmentedit.php:665
$year
else $year
Definition: appointmentedit.php:655
$month
else $month
Definition: appointmentedit.php:660
eZXMLRPCDatetime
Definition: ezxmlrpcdatetime.php:37
eZXMLRPCDatetime\addZero
addZero( $value)
Definition: ezxmlrpcdatetime.php:235
eZXMLRPCDatetime\setSecond
setSecond( $value)
Definition: ezxmlrpcdatetime.php:208
eZXMLRPCDatetime\year
year()
Definition: ezxmlrpcdatetime.php:113
eZXMLRPCDatetime\setYear
setYear( $value)
Definition: ezxmlrpcdatetime.php:163
eZXMLRPCDatetime\$Month
$Month
Definition: ezxmlrpcdatetime.php:248
eZXMLRPCDatetime\hour
hour()
Definition: ezxmlrpcdatetime.php:137
eZXMLRPCDatetime\minute
minute()
Definition: ezxmlrpcdatetime.php:145
eZXMLRPCDatetime\setMinute
setMinute( $value)
Definition: ezxmlrpcdatetime.php:199
eZXMLRPCDatetime\$Year
$Year
Definition: ezxmlrpcdatetime.php:247
eZXMLRPCDatetime\$Day
$Day
Definition: ezxmlrpcdatetime.php:249
eZXMLRPCDatetime\setDay
setDay( $value)
Definition: ezxmlrpcdatetime.php:181
eZXMLRPCDatetime\$Minute
$Minute
Definition: ezxmlrpcdatetime.php:251
eZXMLRPCDatetime\serialize
& serialize()
Definition: ezxmlrpcdatetime.php:69
eZXMLRPCDatetime\setHour
setHour( $value)
Definition: ezxmlrpcdatetime.php:190
eZXMLRPCDatetime\day
day()
Definition: ezxmlrpcdatetime.php:129
eZXMLRPCDatetime\value
value()
Definition: ezxmlrpcdatetime.php:95
eZXMLRPCDatetime\decode
decode( $value)
Definition: ezxmlrpcdatetime.php:218
eZXMLRPCDatetime\$Second
$Second
Definition: ezxmlrpcdatetime.php:252
eZXMLRPCDatetime\__construct
__construct( $year=0, $month=0, $day=0, $hour=0, $minute=0, $second=0)
Definition: ezxmlrpcdatetime.php:43
eZXMLRPCDatetime\second
second()
Definition: ezxmlrpcdatetime.php:154
eZXMLRPCDatetime\$Hour
$Hour
Definition: ezxmlrpcdatetime.php:250
eZXMLRPCDatetime\setMonth
setMonth( $value)
Definition: ezxmlrpcdatetime.php:172
eZXMLRPCDatetime\month
month()
Definition: ezxmlrpcdatetime.php:121
$minute
$minute
Definition: export_froogle.php:311
$hour
$hour
Definition: export_froogle.php:310
$now
$now
Definition: ezcalendar/user/dayview.php:401
$ret
$ret
Definition: ezsitemanager/admin/filelist.php:88
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.