Change language

PHP IntlDateFormatter getDateType () function

Syntax:
  • Object Oriented Style:
    int IntlDateFormatter::getDateType (void )
  • Procedural style:
    int datefmt_get_datetype (IntlDateFormatter $fmt)
Parameters:This function uses a single $fmt parameter,which contains the formatter resource.Returned value: this function returns the current value of the formatter date type.The following programs illustrate the IntlDateFormatter::getDateType() function in PHP:Program 1:  
// Create date formatter $formatter = datefmt_create ( ’ en_US’ , IntlDateFormatter::FULL, IntlDateFormatter::FULL, ’Asia / Kolkata’ , IntlDateFormatter::TRADITIONAL, "MM / dd / yyyy");  
// Get the type of date / type formatter echo ’Calendar of formatter:’ . datefmt_get_datetype ( $formatter ). "" ;  
// Get the date / time value formatted as a string echo "Formatted calendar output:" . datefmt_format ( $formatter , 0). "" ;  
// Create a date formatter $formatter = datefmt_create ( ’en_US’ , IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, ’Asia / Kolkata’ , IntlDateFormatter::TRADITIONAL );  
// Get the type of date / type formatter echo ’Calendar of formatter:’ . datefmt_get_datetype ( $formatter ). "" ;  
// Get the date / time value formatted as a string echo "Formatted calendar output:" . datefmt_format ( $formatter , 0);  
?>
Exit:
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:  
// Create date formatter $formatter = datefmt_create ( ’en_US’ , IntlDateFormatter::FULL, IntlDateFormatter::FULL, ’Asia / Kolkata’ , IntlDateFormatter::TRADITIONAL, "MM / dd / yyyy");  
// Get the type of date / type formatter echo ’Calendar of formatter:’ . $formatter -> getDateType(). "" ;  
// Get date / time format // string value echo "Formatted calendar output: " . $formatter -> format (0). "" ;  
// Create a date formatter $formatter = datefmt_create ( ’en_US’ , IntlDateFormatter::SHORT, IntlDateFormatter::SHORT, ’Asia / Kolkata’ , IntlDateFormatter::TRADITIONAL );  
// Get the type of date / type formatter echo ’Calendar of formatter:’ . $formatter -> getDateType(). "" ;  
// Get date / time format // string value echo "Formatted calendar output: " . $formatter -> format (0);  
?>
Exit:
Calendar of formatter : 0 Formatted calendar output: 01/01/1970 Calendar of formatter: 3 Formatted calendar output: 1/1/70, 5:30 AM
Link:https://www.php.net/manual/en/intldateformatter.getdatetype.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