PHP | IntlCalendar getFirstDayOfWeek() Function
The IntlCalendar::getFirstDayOfWeek() function is an inbuilt function in PHP which is used to return the first day of the week for the calendar.
Syntax:
Parameters: This function uses single parameter $cal which holds the resource of IntlCalendar.
Return Value: This function returns one of the IntlCalendar field constants like IntlCalendar::DOW_SUNDAY, IntlCalendar::DOW_MONDAY, …, IntlCalendar::DOW_SATURDAY on success or FALSE on failure.
Below program illustrates the IntlCalendar::getFirstDayOfWeek() function in PHP:
Program:
<?php
ini_set ( 'date.timezone' , 'Asia/Calcutta' );
ini_set ( 'date.timezone' , 'UTC' );
$calendar1 = IntlCalendar::fromDateTime( '2019-09-22' );
var_dump( $calendar1 ->getFirstDayOfWeek());
var_dump( $calendar1 ->get(IntlCalendar::FIELD_WEEK_OF_YEAR));
$calendar2 = IntlCalendar::createInstance(NULL, 'en_US' );
var_dump( $calendar2 ->getFirstDayOfWeek());
$calendar2 ->set(2020, 05, 20);
var_dump( $calendar2 ->get(IntlCalendar::FIELD_IS_LEAP_MONTH));
?>
|
Output:
int(1)
int(39)
int(1)
int(0)
Reference: https://www.php.net/manual/en/intlcalendar.getfirstdayofweek.php
Last Updated :
25 Sep, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...