On Mon, 11 Jul 2005, Pierre-Alain Joye wrote:
> On Mon, 11 Jul 2005 10:16:45 -0700
> Andrei Zmievski <[EMAIL PROTECTED]> wrote:
>
> > Can we please wrap up the whole OO/non-OO discussion and just fix
> > the damn ext/date so that it works as advertised? The rest can be
> > done later. Let's not hold up RC1 unless really necessary.
>
> It's not a stopping for 5.1. This is not going to be in 5.1. We
> already agreed on that :)
We did not. I implemented my specs now, including OO methods. Updated
ones are attached.
Derick
--
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org
Definitions:
Timezone Abbreviation: CEST, EEST, PDT
Timezone Identifier: Europe/Oslo, Europe/Helsinki, America/Los_Angeles
Timezone database: Database consisting of all timezone definitions and
Transition Times.
Transistion Time: Time where the GMT offset in a timezone changes (f.e.
due to a DST changeover)
Timezone related functions
obj timezone timezone_open(string timezone);
Loads a timezone from the database. First the timezone will be looked
for
in the Timezone Abbreviation database and the corresponding Timezone
Identifier is then opened from the database. If the timezone is not
found
in the Timezone Abbreviation database, then the function attempts to
load
it directly from the Timezone database.
string timezone_name_get(obj timezone);
string [obj timezone]->getName();
Returns the Timezone Identifier belonging to the timezone object.
int timezone_offset_get(obj timezone, obj date);
string [obj timezone]->getOffset();
Returns the GMT offset belonging to the date object in the passed
timezone.
array timezone_transistions_get(obj timezone);
array [obj timezone]->getTransistions();
Returns a multi-dimensional array containing all the known Transistion
Times. Each element in the returned array consists of five elements. The
elements are: "ts": the unix timestamp; "time": a string in the format
"yyyy-mm-ddThh:ii:ssZ" describing the transistion time; "offset": the
GMT
offset accompanying the Transistion Time; "isdst": whether the Timezone
is a DST time or not and "abbr": the abbreviation belonging to the
entry.
array timezone_abbreviations_list();
array [class timezone]::listAbbreviations();
Returns a multi-dimensional associate array where the key is the
Timezone
Abbreviation and as data an array with three elements: "offset"
describes
the GMT offset in seconds, "dst" whether the Timezone Abbreviation is a
DST
abbreviation or not and "timezone_id" containing the Timezone
Identifier as
string if it exists, or NULL otherwise.
array timezone_identifiers_list();
array [class timezone]::listIdentifiers();
Returns a single-dimensional array with all available Timezone
Identifiers
as string.
Date related functions
obj date date_create(string date_representatation [, obj timezone]);
Creates a date object out of a string representation of date/time
information - analogous to strtotime().
obj timezone date_timezone_get(obj date);
obj timezone [obj date]->getTimezone();
Returns a timezone object associated with the date object. Returns false
if the time was not a local time, but UTC time.
int date_offset_get(obj date);
int [obj date]->getOffset();
Returns the offset in seconds that belongs to the time that the date
object
represents in the assigned timezone. If the date is currently
representing
UTC time, then 0 will be returned, and if the date is representing a
local
time then the offset to UTC will be returned.
bool date_timezone_set(obj date, obj timezone);
bool [obj date]->setTimezone(obj timezone);
Updates the date object's timezone with the passed timezone object.
Returns
true if this succeeded, or false when it doesn't (which I can't find a
reason for why that might happen right now).
bool date_timezone_set_by_name(obj date, string timezone);
bool [obj date]->setTimezoneByName(obj timezone);
Updates the date object's timezone with the passed timezone string. The
same algorithm for determining the Timezone Identifier is used as when
creating a timezone object with timezone_open(). Returns false if the
timezone could not be found, true if everything went Ok.
bool date_to_utc(obj date);
bool [obj date]->toUTC();
Unassociates the timezone information from the date, reverting it to UTC
time. Returns true if there was something changed, false if the date
object was already representing UTC time.
bool date_to_local(obj date);
bool [obj date]->toLocal();
Associates the timezone information already available in the date object
with the date object again. This results in the representation using the
local time with an offset to UTC again. Returns true if there was
something
changed, false if the date object was already representing local time.
string date_format(date obj, string format);
bool [obj date]->format(string format);
Formats a date with the format string "format". The same format
modifiers
are being used as with the date() function.
bool date_modify(date obj, string modify_string);
bool [obj date]->modify(string modify_string);
Uses strtotime() functionality for modifying the date object. An
example of
such a modifying string is "next month". If an invalid format is passed,
false will be returned, otherwise the date will be modified and true
returned.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php