Back to index

php5  5.3.10
Classes | Functions
datefmt_api.php File Reference

Go to the source code of this file.

Classes

class  DateFormatter
 Date Formatter class - locale-dependent formatting/parsing of dates using pattern strings and/or canned patterns. More...

Functions

 datefmt_create ($locale, $datetype, $timetype, $timezone=null, $calendar=null, $pattern=null)
 Create a date formatter.
 datefmt_format ($fmt, $value)
 formats the time value as a string.
 datefmt_parse ($fmt, $value, $parse_pos=0)
 converts string $value to an incremental time value, starting at $parse_pos and consuming as much of the input value as possible If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended (and the error occurred).
 datefmt_localtime ($fmt, $value, $parse_pos=0)
 converts string $value to a field-based time value, starting at $parse_pos and consuming as much of the input value as possible If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended (and the error occurred).
 datefmt_get_datetype ($fmt)
 Gets the Datetype in use.
 datefmt_get_timetype ($fmt)
 Gets the timetype in use.
 datefmt_is_lenient ($fmt)
 Gets the leniency of the formatter.
 datefmt_set_lenient ($fmt, $lenient)
 Sets the leniency of the formatter.
 datefmt_get_locale ($fmt, $type=ULOC_ACTUAL_LOCALE)
 Gets the locale in use.
 datefmt_get_timezone_id ($fmt)
 Gets the time zone id in use.
 datefmt_set_timezone_id ($fmt, $zone)
 Sets the time zone to use.
 datefmt_set_calendar ($fmt, $which)
 Sets the calendar used to the appropriate calendar, which must be one of the constants defined above.
 datefmt_get_calendar ($fmt)
 Gets the calendar in use.
 datefmt_get_pattern ($fmt)
 Gets the pattern in use.
 datefmt_set_pattern ($fmt, $pattern)
 Sets the pattern to use.
 datefmt_get_error_code ($fmt)
 Get the error code from last operation.
 datefmt_get_error_message ($fmt)
 Get the error text from the last operation.

Function Documentation

datefmt_create ( locale,
datetype,
timetype,
timezone = null,
calendar = null,
pattern = null 
)

Create a date formatter.

Parameters:
string$localeLocale to use when formatting or parsing
integer$datetypeDate type to use (none, short, medium, long, full)
integer$timetypeTime type to use (none, short, medium, long, full)
[string]$timezone Time zone ID ; default is system default
[integer]$calendar Calendar to use for formatting or parsing; default is GREGORIAN
[string]$pattern Optional pattern to use when formatting or parsing
Returns:
DateFormatter
See also:
datefmt_create

Definition at line 262 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_format ( fmt,
value 
)

formats the time value as a string.

Parameters:
DateFormatter$fmtThe date formatter resource
mixed$value- value to format integer: a unix timestamp value (seconds since epoch, UTC) array: a localtime array - uses 24 hour clock in tm_hour field
Returns:
string a formatted string or, if an error occurred, 'null'.

Definition at line 273 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Gets the calendar in use.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
integer the calendar being used by the formatter

Definition at line 398 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Gets the Datetype in use.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
integer the current 'datetype' value of the formatter

Definition at line 313 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Get the error code from last operation.

Parameters:
DateFormatter$fmtThe date formatter resource Returns error code from the last number formatting operation.
Returns:
integer the error code, one of UErrorCode values. Initial value is U_ZERO_ERROR.

Definition at line 427 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Get the error text from the last operation.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
string Description of the last error.

Definition at line 436 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_get_locale ( fmt,
type = ULOC_ACTUAL_LOCALE 
)

Gets the locale in use.

Parameters:
DateFormatter$fmtThe date formatter resource
[integer]which locale should be returned? values may include ULOC_ACTUAL_LOCALE, ULOC_VALID_LOCALE. By default the actual locale is returned.
Returns:
string the locale of this formatter or 'false' if error

Definition at line 357 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_get_pattern ( fmt)

Gets the pattern in use.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
string the pattern string being used to format/parse

Definition at line 406 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Gets the timetype in use.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
integer the current 'timetype' value of the formatter

Definition at line 321 of file datefmt_api.php.

{}

Here is the caller graph for this function:

Gets the time zone id in use.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
string ID string for the time zone used by this formatter

Definition at line 365 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_is_lenient ( fmt)

Gets the leniency of the formatter.

Parameters:
DateFormatter$fmtThe date formatter resource
Returns:
boolean 'true' if parser is lenient, 'false' if parser is strict default value for parser is 'false'.

Definition at line 330 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_localtime ( fmt,
value,
parse_pos = 0 
)

converts string $value to a field-based time value, starting at $parse_pos and consuming as much of the input value as possible If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended (and the error occurred).

Parameters:
DateFormatter$fmtThe date formatter resource
string$valuestring to convert to a time
integer$parse_posposition at which to start the parsing in $value (zero-based) This variable will contain the end position if the parse fails If $parse_pos > strlen($value), the parse fails immediately.
Returns:
array localtime compatible array of integers - uses 24 hour clock in tm_hour field

Definition at line 305 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_parse ( fmt,
value,
parse_pos = 0 
)

converts string $value to an incremental time value, starting at $parse_pos and consuming as much of the input value as possible If no error occurs before $value is consumed, $parse_pos will contain -1 otherwise it will contain the position at which parsing ended (and the error occurred).

Parameters:
DateFormatter$fmtThe date formatter resource
string$valuestring to convert to a time
integer$parse_posposition at which to start the parsing in $value (zero-based) This variable will contain the end position if the parse fails If $parse_pos > strlen($value), the parse fails immediately.
Returns:
integer timestamp parsed value

Definition at line 289 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_set_calendar ( fmt,
which 
)

Sets the calendar used to the appropriate calendar, which must be one of the constants defined above.

Some examples include:

  • Gregorian calendar
  • Traditional Default value is GREGORIAN
    Parameters:
    DateFormatter$fmtThe date formatter resource
    integer$whichthe calendar (an enumerated constant) to use.
    Returns:
    boolean 'true' if successful, 'false' if an error occurred or if the calendar was not recognized

Definition at line 390 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_set_lenient ( fmt,
lenient 
)

Sets the leniency of the formatter.

Parameters:
DateFormatter$fmtThe date formatter resource
boolean$lenientsets whether the parser is lenient or not, default is 'false' 'true' sets the parser to accept otherwise flawed date or time patterns, parsing as much as possible to obtain a value. 'false' sets the parser to strictly parse strings into dates. Extra space, unrecognized tokens, or invalid values ("Feburary 30th") are not accepted.
Returns:
boolean 'true' if successful; 'false' if an error occurred.

Definition at line 345 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_set_pattern ( fmt,
pattern 
)

Sets the pattern to use.

Parameters:
DateFormatter$fmtThe date formatter resource
string$patternnew pattern string to use
Returns:
boolean 'true' if successful, 'false' if an error occured. Bad format strings are usually the cause of the latter.

Definition at line 416 of file datefmt_api.php.

{}

Here is the caller graph for this function:

datefmt_set_timezone_id ( fmt,
zone 
)

Sets the time zone to use.

Parameters:
DateFormatter$fmtThe date formatter resource
string$zonezone ID string of the time zone to use. if null or the empty string, the default time zone for the runtime is used.
Returns:
boolean 'true' on successful setting of the time zone, 'false' if an error occurred (such as the time zone wasn't recognized).

Definition at line 377 of file datefmt_api.php.

{}

Here is the caller graph for this function: