PHP | IntlCalendar::__construct() Function
Last Updated :
29 Aug, 2019
The IntlCalendar::__construct() function is an inbuilt function in PHP which is used to create a private constructor for disallowing instantiation.
Syntax:
private IntlCalendar::__construct( void )
Parameters: This function does not accept any parameters.
Return Value: This function does not return any value.
Below program illustrates the IntlCalendar::__construct() function in PHP:
Program:
<?php
$calendar = IntlCalendar::fromDateTime( '2019-08-29 09:19:29' );
$calendar ->add(IntlCalendar::FIELD_YEAR, 5);
echo IntlDateFormatter::formatObject( $calendar ), "\n" ;
$calendar ->add(IntlCalendar::FIELD_YEAR, 10);
echo IntlDateFormatter::formatObject( $calendar ), "\n" ;
$calendar ->add(IntlCalendar::FIELD_HOUR_OF_DAY, 10);
echo IntlDateFormatter::formatObject( $calendar );
?>
|
Output:
Aug 29, 2024, 9:19:29 AM
Aug 29, 2034, 9:19:29 AM
Aug 29, 2034, 7:19:29 PM
Reference: https://www.php.net/manual/en/intlcalendar.construct.php
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...