tags:

views:

217

answers:

7

Sounds easy, but I can't find where this built in class and others exists in the documentation. I use functions but want to know what there is on the OO side.

+2  A: 

It's not a URL or anything, but you can get a fair idea using Reflection:

Reflection::export(new ReflectionClass('DateTime'));

Class [  class DateTime ] {

  - Constants [11] {
    Constant [ string ATOM ] { Y-m-d\TH:i:sP }
    Constant [ string COOKIE ] { l, d-M-y H:i:s T }
    Constant [ string ISO8601 ] { Y-m-d\TH:i:sO }
    Constant [ string RFC822 ] { D, d M y H:i:s O }
    Constant [ string RFC850 ] { l, d-M-y H:i:s T }
    Constant [ string RFC1036 ] { D, d M y H:i:s O }
    Constant [ string RFC1123 ] { D, d M Y H:i:s O }
    Constant [ string RFC2822 ] { D, d M Y H:i:s O }
    Constant [ string RFC3339 ] { Y-m-d\TH:i:sP }
    Constant [ string RSS ] { D, d M Y H:i:s O }
    Constant [ string W3C ] { Y-m-d\TH:i:sP }
  }

  - Static properties [0] {
  }

  - Static methods [0] {
  }

  - Properties [0] {
  }

  - Methods [9] {
    Method [  public method __construct ] {
    }

    Method [  public method format ] {
    }

    Method [  public method modify ] {
    }

    Method [  public method getTimezone ] {
    }

    Method [  public method setTimezone ] {
    }

    Method [  public method getOffset ] {
    }

    Method [  public method setTime ] {
    }

    Method [  public method setDate ] {
    }

    Method [  public method setISODate ] {
    }
  }
}

Not perfect, as there are no arguments, but a starting point at least. They should make this easier to find out, I agree!

majelbstoat
It was then constructor I was particular interested in, which reflection doesn't give. I'm new to the reflection class, and may use it some time (I wonder if its easy to find in the PHP documentation?)
:) http://au.php.net/oop5.reflectionIf it's particularly the constructor, this may help:<?phpdate_default_timezone_set('Europe/London');$datetime = new DateTime('2008-08-03 14:52:10');echo $datetime->format(DATE_ATOM);?>(From the date_create() manual page).
majelbstoat
A: 

There is a list of new classes in PHP 5.2.0 here:

http://www.php.net/manual/en/migration52.classes.php

..which links to the new DateTime class info here:

http://www.php.net/manual/en/ref.datetime.php

Tim
A: 

The URL you mentioned http://www.php.net/manual/en/migration52.classes.php doens't describe the class at all. Surely there is somewhere where this and other classes are documented.

+1  A: 
OIS
A: 

A description can be found in the comments of the documentation :

http://php.net/manual/fr/book.datetime.php#84699

EDIT : This morning I found something interresting :

http://laughingmeme.org/2007/02/27/looking-at-php5s-datetime-and-datetimezone/

e-satis
But shouldn't these classes be documented somewhere? I can't depend on contributed notes, and in any case they don't provide complete documentation.
Indeed. A lot of things are undocumented in PHP 5, that's the trouble. PHP has built its rep partly because of its great documentation that compensated the "messeiness" of the language. Now the language becomes tidy, and the doc uncomplete. Is there a law behind this ? I add a link to my answser...
e-satis
A: 

The DateTime class documentation can be found at php.net/DateTime , this has information on both the class and functions, or just the class documentation is available at php.net/manual/en/class.datetime.php

Luke P M
A: 

The stuff is documented in documentation - maybe not that time you asked for it.

Anyway, by the author of the extension, you can have a read to get the full details: http://derickrethans.nl/phparchitects-guide-to-date-and-time-programming.html

Next to that Derick Rethans is giving talks here and there about the subject and slides are available. If you have the chance to visit a conference and listen to one of his talks, just do it.

A recent one:

FrOsCon, 22 Aug 2010: xxxx://derickrethans.nl/talks/time-froscon10.pdf (Source: xxxx://derickrethans.nl/talks.html)

hakre