(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Get the datetype used for the IntlDateFormatter
public int IntlDateFormatter::getDateType ( void )
Object oriented style
Procedural style
Returns date type used by the formatter.
Parameters:
fmt
The formatter resource.
Returns:
The current date type value of the formatter.
Examples:
datefmt_get_datetype() example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | <?php $fmt = datefmt_create( 'en_US' , IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles' , IntlDateFormatter::GREGORIAN ); echo 'datetype of the formatter is : ' . datefmt_get_datetype( $fmt ); echo 'First Formatted output with datetype is ' . datefmt_format( $fmt , 0); $fmt = datefmt_create( 'en_US' , IntlDateFormatter::SHORT, IntlDateFormatter::FULL, 'America/Los_Angeles' , IntlDateFormatter::GREGORIAN ); echo 'Now datetype of the formatter is : ' . datefmt_get_datetype( $fmt ); echo 'Second Formatted output with datetype is ' . datefmt_format( $fmt , 0); ?> |
OO example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?php $fmt = new IntlDateFormatter( 'en_US' , IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'America/Los_Angeles' , IntlDateFormatter::GREGORIAN ); echo 'datetype of the formatter is : ' . $fmt ->getDateType(); echo 'First Formatted output is ' . $fmt ->format(0); $fmt = new IntlDateFormatter( 'en_US' , IntlDateFormatter::SHORT, IntlDateFormatter::FULL, 'America/Los_Angeles' , IntlDateFormatter::GREGORIAN ); echo 'Now datetype of the formatter is : ' . $fmt ->getDateType(); echo 'Second Formatted output is ' . $fmt ->format(0); ?> |
See also:
Please login to continue.