[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/i18n/ -> sfDateFormat.class.php (sommaire)

sfDateFormat class file. This program is free software; you can redistribute it and/or modify it under the terms of the BSD License.

Author: Wei Zhuo
Version: $Id: sfDateFormat.class.php 3409 2007-02-06 08:08:40Z fabien $
Poids: 798 lignes (20 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

sfDateFormat:: (25 méthodes):
  __construct()
  getDate()
  format()
  getFunctionName()
  getPattern()
  getInputPattern()
  getTokens()
  getUnixDate()
  getYear()
  getMon()
  getWday()
  getMday()
  getEra()
  getHours()
  getAMPM()
  getHour12()
  getMinutes()
  getSeconds()
  getTimeZone()
  getYday()
  getDayInMonth()
  getWeekInYear()
  getWeekInMonth()
  getHourInDay()
  getHourInAMPM()


Classe: sfDateFormat  - X-Ref

sfDateFormat class.

The sfDateFormat class allows you to format dates and times with
predefined styles in a locale-sensitive manner. Formatting times
with the sfDateFormat class is similar to formatting dates.

Formatting dates with the sfDateFormat class is a two-step process.
First, you create a formatter with the getDateInstance method.
Second, you invoke the format method, which returns a string containing
the formatted date.

DateTime values are formatted using standard or custom patterns stored
in the properties of a DateTimeFormatInfo.

__construct($formatInfo = null)   X-Ref
Initialize a new sfDateFormat.

param: mixed either, null, a sfCultureInfo instance, a DateTimeFormatInfo instance, or a locale.
return: sfDateFormat instance

getDate($time, $pattern = null)   X-Ref
Guesses a date without calling strtotime.

author: Olivier Verdier <Olivier.Verdier@gmail.com>
param: mixed the time as integer or string in strtotime format.
param: string the input pattern; default is sql date or timestamp
return: array same array as the getdate function

format($time, $pattern = 'F', $inputPattern = null, $charset = 'UTF-8')   X-Ref
Format a date according to the pattern.

param: mixed the time as integer or string in strtotime format.
return: string formatted date time.

getFunctionName($token)   X-Ref
For a particular token, get the corresponding function to call.

param: string token
return: mixed the function if good token, null otherwise.

getPattern($pattern)   X-Ref
Get the pattern from DateTimeFormatInfo or some predefined patterns.
If the $pattern parameter is an array of 2 element, it will assume
that the first element is the date, and second the time
and try to find an appropriate pattern and apply
DateTimeFormatInfo::formatDateTime
See the tutorial documentation for futher details on the patterns.

param: mixed a pattern.
return: string a pattern.

getInputPattern($pattern)   X-Ref
Returns an easy to parse input pattern
yy is replaced by yyyy and h by H

param: string pattern.
return: string input pattern

getTokens($pattern)   X-Ref
Tokenize the pattern. The tokens are delimited by group of
similar characters, e.g. 'aabb' will form 2 tokens of 'aa' and 'bb'.
Any substrings, starting and ending with a single quote (')
will be treated as a single token.

param: string pattern.
return: array string tokens in an array.

getUnixDate($date)   X-Ref
Pas de description

getYear($date, $pattern = 'yyyy')   X-Ref
Get the year.
"yy" will return the last two digits of year.
"yyyy" will return the full integer year.

param: array getdate format.
param: string a pattern.
return: string year

getMon($date, $pattern = 'M')   X-Ref
Get the month.
"M" will return integer 1 through 12
"MM" will return the narrow month name, e.g. "J"
"MMM" will return the abrreviated month name, e.g. "Jan"
"MMMM" will return the month name, e.g. "January"

param: array getdate format.
param: string a pattern.
return: string month name

getWday($date, $pattern = 'EEEE')   X-Ref
Get the day of the week.
"E" will return integer 0 (for Sunday) through 6 (for Saturday).
"EE" will return the narrow day of the week, e.g. "M"
"EEE" will return the abrreviated day of the week, e.g. "Mon"
"EEEE" will return the day of the week, e.g. "Monday"

param: array getdate format.
param: string a pattern.
return: string day of the week.

getMday($date, $pattern = 'd')   X-Ref
Get the day of the month.
"d" for non-padding, "dd" will always return 2 characters.

param: array getdate format.
param: string a pattern.
return: string day of the month

getEra($date, $pattern = 'G')   X-Ref
Get the era. i.e. in gregorian, year > 0 is AD, else BC.

param: array getdate format.
param: string a pattern.
return: string era

getHours($date, $pattern = 'H')   X-Ref
Get the hours in 24 hour format, i.e. [0-23].
"H" for non-padding, "HH" will always return 2 characters.

param: array getdate format.
param: string a pattern.
return: string hours in 24 hour format.

getAMPM($date, $pattern = 'a')   X-Ref
Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.

param: array getdate format.
param: string a pattern.
return: string AM or PM designator

getHour12($date, $pattern = 'h')   X-Ref
Get the hours in 12 hour format.
"h" for non-padding, "hh" will always return 2 characters.

param: array getdate format.
param: string a pattern.
return: string hours in 12 hour format.

getMinutes($date, $pattern = 'm')   X-Ref
Get the minutes.
"m" for non-padding, "mm" will always return 2 characters.

param: array getdate format.
param: string a pattern.
return: string minutes.

getSeconds($date, $pattern = 's')   X-Ref
Get the seconds.
"s" for non-padding, "ss" will always return 2 characters.

param: array getdate format.
param: string a pattern.
return: string seconds

getTimeZone($date, $pattern = 'z')   X-Ref
Get the timezone from the server machine.

param: array getdate format.
param: string a pattern.
return: string time zone

getYday($date, $pattern = 'D')   X-Ref
Get the day in the year, e.g. [1-366]

param: array getdate format.
param: string a pattern.
return: int hours in AM/PM format.

getDayInMonth($date, $pattern = 'FF')   X-Ref
Get day in the month.

param: array getdate format.
param: string a pattern.
return: int day in month

getWeekInYear($date, $pattern = 'w')   X-Ref
Get the week in the year.

param: array getdate format.
param: string a pattern.
return: int week in year

getWeekInMonth($date, $pattern = 'W')   X-Ref
Get week in the month.

param: array getdate format.
return: int week in month

getHourInDay($date, $pattern = 'k')   X-Ref
Get the hours [1-24].

param: array getdate format.
param: string a pattern.
return: int hours [1-24]

getHourInAMPM($date, $pattern = 'K')   X-Ref
Get the hours in AM/PM format, e.g [1-12]

param: array getdate format.
param: string a pattern.
return: int hours in AM/PM format.



Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7