PHP Doku:: The DateInterval class - class.dateinterval.html

Verlauf / Chronik / History: (1) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzDatums- und zeitrelevante ErweiterungenDatum und UhrzeitThe DateInterval class

Ein Service von Reinhard Neidl - Webprogrammierung.

Datum und Uhrzeit

<<DateTimeZone::listIdentifiers

DateInterval::__construct>>


UnterSeiten:

The DateInterval class

Einführung

Representation of date interval. A date interval stores either a fixed amount of time (in years, months, days, hours etc) or a relative time string in the format that DateTime's constructor supports.

Klassenbeschreibung

DateInterval {
/* Eigenschaften */
public integer $y ;
public integer $m ;
public integer $d ;
public integer $h ;
public integer $i ;
public integer $s ;
public integer $invert ;
public mixed $days ;
/* Methoden */
public __construct ( string $interval_spec )
public static DateInterval createFromDateString ( string $time )
public string format ( string $format )
}

Eigenschaften

y

Number of years.

m

Number of months.

d

Number of days.

h

Number of hours.

i

Number of minutes.

s

Number of seconds.

invert

Is 1 if the interval is inverted and 0 otherwise. See DateInterval::format().

days

Total number of days the interval spans. If this is unknown, days will be FALSE.

Inhaltsverzeichnis


2 BenutzerBeiträge:
- Beiträge aktualisieren...
jeff dot davies at yahoo dot com
15.09.2010 2:15
This class became available in PHP 5.3. It is not present in 5.2 or earlier releases. I found this out the hard way when you PHP scripts stopped working when I deployed them onto a Yahoo server. Yahoo has 5.2 while my machine hosts 5.3.
sebastien dot michea at manaty dot net
30.08.2010 5:25
It would be nice that when converting a DateInterval to a string, the interval specification used to construct the object is returned (like "P2W").
I need this to serialize a DateInterval object in order to store it in a postgres DB.



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)