Change language

PHP IntlCalendar toDateTime () function

Syntax:
  • Object Oriented Style
    DateTime IntlCalendar::toDateTime (void )
  • Procedural style
    DateTime intlcal_to_date_time (IntlCalendar $cal)
Parameters:This function takes one parameter, $cal,which contains the IntlCalendar object resource.Return value:this function returns a DateTime object with the same time zone as this object and the same time, except for less precision on success, and returns FALSE on error.The following program illustrates the IntlCalendar function: : toDateTime() in PHP:Program :  
// Set the DateTime zone ini_set ( ’date.timezone’ , ’Asia / Calcutta’ ); ini_set ( ’date.timezone’ , ’UTC’ );  
// Create an IntlCalendar instance $calendar = IntlCalendar::createInstance ( ’Asia / Calcutta’ );  
// Convert IntlCalendar to DateTime $datetime = $calendar -> toDateTime();  
// Display the DateTime object var_dump ( $datetime );  
// Declare IntlGregorianCalendar $calendar = new IntlGregorianCalendar (2019, 9, 22, 12, 40, 0);  
// Convert IntlGregorianCalendar to
// DateTime object $datetime = $calendar -> toDateTime();  
// Display the DateTime object var_dump ( $datetime );  
?>
Exit:
object (DateTime ) # 3 (3) {["date"] = > string (26) "2019-09-25 11: 15: 33.000000" ["timezone_type"] = > int (3) ["timezone"] = > string (13) "Asia / Calcutta"} object (DateTime) # 4 (3) {["date"] = > string (26) "2019-10-22 12: 40: 00.000000" ["timezone_type"] = > int (3) ["timezone"] = > string (3) "UTC"}
Link: https://www.php.net/manual/en/intlcalendar.todatetime.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