util 
[ doc home ] [ class tree: util ] [ index: util ] [ all elements ]

Class: IsterDate

Source Location: /IsterDate.php

Class Overview

IsterObject
   |
   --IsterDate

This class represents a date.


Author(s): Ingo Schramm   

Copyright: Copyright (c) 2005 Ister.ORG Ingo Schramm

Methods


Inherited Constants

Inherited Variables

Inherited Methods

Class: IsterObject

IsterObject::IsterObject()
Constructor
IsterObject::abstractMethodError()
Report attempt to call an abstract method.
IsterObject::addLogger()
Add an IsterLogger to process log messages.
IsterObject::deleteLogger()
Delete an already registered IsterLogger.
IsterObject::getLoggerNames()
Fetch the names of all currently registered IsterLoggers.
IsterObject::getMem()
Return maximum amount of memory an application has allocated at this point.
IsterObject::log()
Trigger a log message.
IsterObject::passPHPmessage()
Catch PHP E_WARNING and E_NOTICE messages.
IsterObject::serialize()
Serialize the object.
IsterObject::setLogLocal()
Set logging local for the current object.
IsterObject::setupLogger()
Setup a logger.
IsterObject::triggerError()
Alias for log();
IsterObject::unserialize()
Unserialize the object.
IsterObject::__sleep()
Executed prior to serialize().
IsterObject::__wakeup()
Executed prior to unserialize().

Class Details

This class represents a date.

copyright:  Copyright (c) 2005 Ister.ORG Ingo Schramm
author:  Ingo Schramm


[ Top ]


Class Methods


constructor IsterDate

IsterDate IsterDate( )

Constructor

By default this date is initialized with all zero. Use setUnix() or setSQL() to initialize this with a valid date.


[ Top ]

method getArray

array getArray( )

Get an array representation of this date with the keys as numbers.

The values of the array are strings with leading zeros.


[ Top ]

method getFormatted

string getFormatted( mixed $format, [mixed $local = false])

Get this dateg formatted according to string.

If the $local parameter is false, this date will be used as a GMT date, otherwise it will represent a local date.

For a description of format strings please refer to the documentation of the PHP function date().

Note: Currently this method does not check for boundaries. If this date is out of range for a unix timestamp, the overflow will produce unexpected results.


[ Top ]

method getNamedArray

array getNamedArray( )

Get an array representation of this date with the keys as strings.

  1. array( 'year' => YYYY,
  2. 'month' => MM,
  3. 'day' => DD,
  4. 'hour' => hh,
  5. 'minute' => mm,
  6. 'second' => ss )


[ Top ]

method getSQL

string getSQL( )

Return this date as an SQL datetime string

[ Top ]

method getSQLDate

string getSQLDate( )

Return this date as an SQL date string.

[ Top ]

method getSQLTime

string getSQLTime( )

Return this date as an SQL time string

[ Top ]

method getUnix

integer getUnix( [boolean $local = false])

Return this date as a Unix timestamp.

If the $local parameter is false, this date will be used as a GMT date, otherwise it will represent a local date.


Parameters:

boolean   $local  

[ Top ]

method isGregorian

boolean isGregorian( )

Checks whether this date is a valid gregorian date.

[ Top ]

method isTime

boolean isTime( )

Checks whether this date has a valid time.

[ Top ]

method isValid

void isValid( )

[ Top ]

method setArray

boolean setArray( mixed $array)

Initialize this date with an array.

The array may be an array as returned by getArray() or getNamedArray(). The method returns false on error or if the date is not valid.


[ Top ]

method setSQL

boolean setSQL( string $date)

Initialize this date with an SQL DATETIME string.

Format: 'YYYY-MM-DD HH:mm:ss'

The method returns false on error or if the date is not valid.


Parameters:

string   $date  

[ Top ]

method setUnix

boolean setUnix( [integer $time = 0])

Set the internal timestamp of this to the given unix time or initialize with current time if no time is given.

The method returns false on error or if the date is not valid.


Parameters:

integer   $time  

[ Top ]


Documentation generated on Tue, 20 Dec 2005 11:20:42 +0100 by phpDocumentor 1.3.0RC4