[ Index ]
 

Code source de PRADO 3.0.6

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

title

Body

[fermer]

/framework/Util/ -> TSimpleDateFormatter.php (sommaire)

TSimpleDateFormatter class file

Author: Wei Zhuo
Copyright: Copyright © 2006 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TSimpleDateFormatter.php 1397 2006-09-07 07:55:53Z wei $
Poids: 371 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

TSimpleDateFormatter:: (18 méthodes):
  __construct()
  getPattern()
  setPattern()
  getCharset()
  setCharset()
  format()
  getMonthPattern()
  getDayPattern()
  getYearPattern()
  getDayMonthYearOrdering()
  getDate()
  isValidDate()
  parse()
  length()
  charAt()
  substring()
  charEqual()
  getInteger()


Classe: TSimpleDateFormatter  - X-Ref

TSimpleDateFormatter class.

Formats and parses dates using the SimpleDateFormat pattern.
This pattern is compatible with the I18N and java's SimpleDateFormatter.
<code>
Pattern |      Description
----------------------------------------------------
d       | Day of month 1 to 31, no padding
dd      | Day of monath 01 to 31, zero leading
M       | Month digit 1 to 12, no padding
MM      | Month digit 01 to 12, zero leading
yy      | 2 year digit, e.g., 96, 05
yyyy    | 4 year digit, e.g., 2005
----------------------------------------------------
</code>

Usage example, to format a date
<code>
$formatter = new TSimpleDateFormatter("dd/MM/yyy");
echo $formatter->format(time());
</code>

To parse the date string into a date timestamp.
<code>
$formatter = new TSimpleDateFormatter("d-M-yyy");
echo $formatter->parse("24-6-2005");
</code>

__construct($pattern, $charset='UTF-8')   X-Ref
Constructor, create a new date time formatter.

param: string formatting pattern.
param: string pattern and value charset

getPattern()   X-Ref

return: string formatting pattern.

setPattern($pattern)   X-Ref

param: string formatting pattern.

getCharset()   X-Ref

return: string formatting charset.

setCharset($charset)   X-Ref

param: string formatting charset.

format($value)   X-Ref
Format the date according to the pattern.

param: string|int the date to format, either integer or a string readable by strtotime.
return: string formatted date.

getMonthPattern()   X-Ref
Pas de description

getDayPattern()   X-Ref
Pas de description

getYearPattern()   X-Ref
Pas de description

getDayMonthYearOrdering()   X-Ref
Pas de description

getDate($value)   X-Ref
Gets the time stamp from string or integer.

param: string|int date to parse
return: array date info array

isValidDate($value)   X-Ref

return: boolean true if the given value matches with the date pattern.

parse($value,$defaultToCurrentTime=true)   X-Ref
Parse the string according to the pattern.

param: string|int date string or integer to parse
return: int date time stamp

length($string)   X-Ref
Calculate the length of a string, may be consider iconv_strlen?


charAt($string, $pos)   X-Ref
Get the char at a position.


substring($string, $start, $length)   X-Ref
Gets a portion of a string, uses iconv_substr.


charEqual($string, $pos, $char)   X-Ref
Returns true if char at position equals a particular char.


getInteger($str,$i,$minlength,$maxlength)   X-Ref
Gets integer from part of a string, allows integers of any length.

param: string string to retrieve the integer from.
param: int starting position
param: int minimum integer length
param: int maximum integer length
return: string integer portition of the string, null otherwise



Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7