PHP | IntlDateFormatter format() Function Last Updated : 10 Oct, 2019 Comments Improve Suggest changes Like Article Like Report 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: This function uses two parameters as mentioned above and described below: fmt: This parameter holds the resource of date object. value: This parameter holds the value to the format. It may be a DateTimeInterface object, an IntlCalendar object, or a numeric type representing a number of seconds. If DateTime or IntlCalendar object is passed then it is not considered. Return Value: This function returns the formatted string on success or False when error occurred. Below program illustrates the IntlDateFormatter::format() function in PHP: Program: php <?php // Create a date formatter $fmt = datefmt_create( 'en_US', IntlDateFormatter::LONG, IntlDateFormatter::LONG, 'Asia/Kolkata', IntlDateFormatter::GREGORIAN ); // Display the date in given format echo 'Formatted output using object oriented style: ' . $fmt->format(0) . "\n"; echo 'Formatted output using procedural style: ' . datefmt_format($fmt, 0) . "\n\n"; // Create a date formatter $fmt = datefmt_create( 'en_US', IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, 'Asia/Kolkata', IntlDateFormatter::GREGORIAN ); // Display the date in given format echo 'Formatted output using object oriented style: ' . $fmt->format(0) ."\n"; echo 'Formatted output using procedural style: ' . datefmt_format($fmt, 0); ?> Output: Formatted output using object oriented style: January 1, 1970 at 5:30:00 AM GMT+5:30 Formatted output using procedural style: January 1, 1970 at 5:30:00 AM GMT+5:30 Formatted output using object oriented style: 1/1/70, 5:30 AM Formatted output using procedural style: 1/1/70, 5:30 AM Reference: https://www.php.net/manual/en/intldateformatter.format.php Comment More infoAdvertise with us Next Article PHP | IntlDateFormatter format() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Intl Similar Reads PHP | IntlDateFormatter formatObject() Function The IntlDateFormatter::formatObject() function is an inbuilt function in PHP which is used to formats an IntlDateFormatter object. This function allows to format the IntlCalendar or DateTime object. Syntax: Object oriented style:string IntlDateFormatter::formatObject( object $object, mixed $format = 2 min read PHP | IntlDateFormatter getDateType() Function 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 ) Paramete 2 min read 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 | IntlChar::forDigit() Function The IntlChar::forDigit() function is an inbuilt function in PHP which is used to determines the character representation for a specific digit in the specified radix. Syntax: int IntlChar::forDigit( $digit, $radix ) Parameters: This function accepts two parameters as mentioned above and described bel 2 min read Like