PHP | IntlDateFormatter getDateType() Function Last Updated : 10 Oct, 2019 Comments Improve Suggest changes Like Article Like Report The IntlDateFormatter::getDateType() function is an inbuilt function in PHP which is used to get the datetype used for the IntlDateFormatter object. Syntax: Object oriented style: int IntlDateFormatter::getDateType( void ) Procedural style: int datefmt_get_datetype( IntlDateFormatter $fmt ) Parameters: This function uses single parameter $fmt which holds the resource of formatter. Return Value: This function returns the current date type value of the formatter. Below programs illustrate the IntlDateFormatter::getDateType() function in PHP: Program 1: php <?php // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL, "MM/dd/yyyy" ); // Get the date/type formatter type echo 'Calendar of formatter: ' . datefmt_get_datetype($formatter) . "\n"; // Get the format of date/time value as a string echo "Formatted calendar output: " . datefmt_format( $formatter , 0) . "\n\n"; // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL ); // Get the date/type formatter type echo 'Calendar of formatter: ' . datefmt_get_datetype($formatter) . "\n"; // Get the format of date/time value as a string echo "Formatted calendar output: " . datefmt_format( $formatter , 0); ?> Output: Calendar of formatter: 0 Formatted calendar output: 01/01/1970 Calendar of formatter: 3 Formatted calendar output: 1/1/70, 5:30 AM Program 2: php <?php // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL, "MM/dd/yyyy" ); // Get the date/type formatter type echo 'Calendar of formatter: ' . $formatter->getDateType() . "\n"; // Get the format of date/time // value as a string echo "Formatted calendar output: " . $formatter->format(0) . "\n\n"; // Create a date formatter $formatter = datefmt_create( 'en_US', IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, 'Asia/Kolkata', IntlDateFormatter::TRADITIONAL ); // Get the date/type formatter type echo 'Calendar of formatter: ' . $formatter->getDateType() . "\n"; // Get the format of date/time // value as a string echo "Formatted calendar output: " . $formatter->format(0); ?> Output: Calendar of formatter: 0 Formatted calendar output: 01/01/1970 Calendar of formatter: 3 Formatted calendar output: 1/1/70, 5:30 AM Reference: https://www.php.net/manual/en/intldateformatter.getdatetype.php Comment More infoAdvertise with us Next Article PHP | IntlDateFormatter getDateType() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlDateFormatter getCalendar() Function The IntlDateFormatter::getCalendar() function is an inbuilt function in PHP which is used to return the calendar type used for the IntlDateFormatter object.Syntax: Object oriented style: int IntlDateFormatter::getCalendar( void )Procedural style: int datefmt_get_calendar( IntlDateFormatter $fmt ) Pa 2 min read PHP | IntlDateFormatter getErrorCode() Function, The IntlDateFormatter::getErrorCode() function is an inbuilt function in PHP which is used to return the error code from last operation. Syntax: Object-oriented style: int IntlDateFormatter::getErrorCode( void ) Procedural style: int datefmt_get_error_code( IntlDateFormatter $fmt ) Parameters: This 1 min read PHP | IntlCalendar getType() Function The IntlCalendar::getType() function is an inbuilt function in PHP which is used to get the calendar type in terms of string. The "calendar" is the valid value of keywords. Syntax: Object oriented stylestring IntlCalendar::getType( void )Procedural stylestring intlcal_get_type( IntlCalendar $cal ) P 1 min read PHP | IntlDateFormatter format() Function The IntlDateFormatter::format() function is an inbuilt function in PHP which is used to format the date/time value as a string. Syntax: Object oriented style: string IntlDateFormatter::format( mixed $value ) Procedural style: string datefmt_format( IntlDateFormatter $fmt, mixed $value ) Parameters: 2 min read PHP | IntlCalendar getTime() Function The IntlCalendar::getTime() function is an inbuilt function in PHP which is used to return the time currently represented by the object. The time is expressed in terms of milliseconds since the epoch. Syntax: Object oriented style float IntlCalendar::getTime( void ) Procedural style float intlcal_ge 1 min read Like