Change language

PHP IntlCalendar get () function

Syntax:
  • Object Oriented Style
    int IntlCalendar::get (int $field)
  • Procedural style
    int intlcal_get (IntlCalendar $cal, int $field )
Parameters:This function uses two parameters as above and described below:
  • $cal:this parameter contains an IntlCalendar resource.
  • $field:This parameter contains one of the IntlCalendar date / time field constants. This field contains an integer value from 0 to IntlCalendar::FIELD_COUNT.
Return value:This function returns an integer that contains the value of the time field.The following program illustrates the IntlCalendar::get() function in PHP:Program :  
// Set DateTime zone ini_set ( ’date.timezone’ , ’Asia / Calcutta’ );  
// Declare IntlCalendar $cls = new ReflectionClass ( ’IntlCalendar’ );  
// Declare an empty array $arr = array ();  
// Loop for IntlCalendar constants foreach ( $cls -> getConstants() as $constName = > $constVal ) { $arr [ $constVal ] = $constName ; }  
// Create an IntlCalendar instance $calendar = IntlCalendar::createInstance ( );  
// Show date object var_dump (IntlDateFormatter::formatObject ( $calendar ));  
// Loop to display the result foreach ( $arr as $constVal = > $constName ) { echo "Constant Name:" . $constName . "Constant Value:" . $calendar -> get ( $constVal ). "" ; }  
?>
Exit:
string (25 ) "Sep 23, 2019, 11:03:29 AM" Constant Name: WALLTIME_LAST Constant Value: 1 Constant Name: WALLTIME_FIRST Constant Value: 2019 Constant Name: WALLTIME_NEXT_VALID Constant Value: 8 Constant Name: DOW_TYPE_WEEKEND_CEASE Constant Value: 39 Constant Name: Constant Value: 4 Constant Name: DOW_THURSDAY Constant Value: 23 Constant Name: DOW_FRIDAY Constant Value: 266 Constant Name: DOW_SATURDAY Constant Value: 2 Constant Name: FIELD_DAY_OF_WEEK_IN_MONTH Constant Value: 4 Constant Name: FIELD_AM_PMant Value : 11 Constant Name: FIELD_HOUR_OF_DAY Constant Value: 11 Constant Name: FIELD_MINUTE Constant Value: 3 Constant Name: FIELD_SECOND Constant Value: 29 Constant Name: FIELD_MILLISECOND Constant Value: 939 Constant Name: FIELD_ZONE_OF00FSET Constant Value: FIELD_ZONE_OF00FSET Constant Name Constant Name: FIELD_YEAR_WOY Constant V alue: 2019 Constant Name: FIELD_DOW_LOCAL Constant Value: 2 Constant Name: FIELD_EXTENDED_YEAR Constant Value: 2019 Constant Name: FIELD_JULIAN_DAY Constant Value: 2458750 Constant Name: FIELD_MILLISECONDS_IN_DAY Constant Value: 39809939 Constant Name
Link: https://www.php.net/ manual / en / intlcalendar.get.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method