[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/data/ -> timestamp.class.php (sommaire)

constants used to determine whether we are using dynamic time difference calculation or static time difference calculation (that is, dates are stored

Poids: 417 lignes (12 kb)
Inclus ou requis:0 fois
Référencé: 23 fois
Nécessite: 0 fichiers

Définit 1 class

Timestamp:: (25 méthodes):
  Timestamp()
  setTime()
  getTimestamp()
  getCentury()
  getMinutes()
  getSeconds()
  getMonthString()
  getMonth()
  setMinutes()
  getWeekdayId()
  getNextMonthAndYear()
  setNextMonthAndYear()
  getPrevMonthAndYear()
  setPrevMonthAndYear()
  getUnixDate()
  getIsoDate()
  getW3Date()
  getDateWithOffset()
  getTimestampWithOffset()
  getBlogDate()
  getAllHours()
  getAllMinutes()
  getNowTimestamp()
  getYears()
  parseDate()


Classe: Timestamp  - X-Ref

\ingroup Data

This class allows to deal with all sorts of different date formats, as many as the PEAR::Date class
supports (Timestamp started as an independent class but later on due to requirements it was developed
as an extension for PEAR::Date, maintaining the previous interface for compatibility reasons)

PEAR::Date has its own documentation available here: http://pear.php.net/package/Date/docs/1.4.2/Date/Date.html

The formats supported by PEAR::Date are:

- DATE_FORMAT_ISO (YYYY-MM-DD HH:MM:SS)
- DATE_FORMAT_ISO_BASIC (YYYYMMSSTHHMMSS(Z|(+/-)HHMM)?)
- DATE_FORMAT_ISO_EXTENDED (YYYY-MM-SSTHH:MM:SS(Z|(+/-)HH:MM)?)
- DATE_FORMAT_ISO_EXTENDED_MICROTIME (YYYY-MM-SSTHH:MM:SS(.S*)?(Z|(+/-)HH:MM)?)
- DATE_FORMAT_TIMESTAMP (YYYYMMDDHHMMSS)
- DATE_FORMAT_UNIXTIME (seconds since the unix epoch)

Use the static method Timestamp::parseDate() in order to use other date formats which are not directly
supported by this class.

Timestamp( $timestamp = null )   X-Ref
Pas de description

setTime( $timestamp, $format = DATE_FORMAT_ISO )   X-Ref


getTimestamp( $format = DATE_FORMAT_TIMESTAMP )   X-Ref


getCentury()   X-Ref
Returns the century corresponding to the given date. If the current year is '2003', then the
century will be '2000', not 21.

return: An integer value representing the current century.

getMinutes()   X-Ref
Returns only the minutes specified by the current date.

return: The minutes specified by the current date.

getSeconds()   X-Ref
Returns only the seconds specified by the current date.

return: The seconds specified by the current date.

getMonthString()   X-Ref
Returns the name of the month using the current locale.

return: A string with the name of the month.

getMonth()   X-Ref

return: Returns the current month, as a value from "00" to "12"

setMinutes( $newMinutes )   X-Ref
Sets a new value for the minutes in this timestamp

param: newMinutes the new value for the minutes

getWeekdayId()   X-Ref
Instead of returning a string it will just return 0 for sunday, 1 for monday,
2 for tuesday, 3 for wednesday and so on...


getNextMonthAndYear()   X-Ref


setNextMonthAndYear()   X-Ref


getPrevMonthAndYear()   X-Ref


setPrevMonthAndYear()   X-Ref


getUnixDate()   X-Ref
Returns the UNIX timestamp for the given date.

return: An integer specifying the unix timestamp for the given date.

getIsoDate()   X-Ref
Returns the date formatted in ISO 8601

return: A string with the date in format ISO 8601

getW3Date()   X-Ref
returns the date formatted according to the W3 specifications


getDateWithOffset( $timeStamp, $timeDiff )   X-Ref
Static method that returns a timestamp after applying a time
difference to it.

param: timeStamp The original ISO timestamp
param: timeDiff The time difference that we'd like to apply to the

getTimestampWithOffset( $timeStamp, $timeDiff )   X-Ref
Equivalent to Timestamp::getDateWithOffset but instead of returning a date,
it returns a Timestamp object with the given time difference applied to the starting
timestamp

param: timeStamp
param: timeDiff
return: A Timestamp object

getBlogDate( $blog, $timestamp = null )   X-Ref

param: blog either a blog id or a BlogInfo object
param: timestamp
return: A Timestamp object with time difference applied, if needed

getAllHours()   X-Ref
stupid function that returns an array with all the hours

return: an array

getAllMinutes()   X-Ref
stupid function that returns an array with... the minutes!

return: an array

getNowTimestamp()   X-Ref
returns the current time as a mysql timestamp


getYears( $minYear = 1900, $maxYear = 2099 )   X-Ref
returns an array with a range of years

param: an array

parseDate( $dateString )   X-Ref
Given a string with a date in whatever format, returns a valid Timestamp object
The date will be parsed via PHP's strtotime()
(http://fi2.php.net/manual/en/function.strtotime.php)

param: dateString a string representing a date.
return: a valid Timestamp object



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics