PHP date_diff() function6 Jan 2025 | 1 min read This function finds out the difference between the two DateTime objects. It represents the difference of days between two dates. SyntaxParameters
Example 1Output: +31 days Example 2Output: 5 Next TopicPhp-date-format-function |
PHP time and date functions informus about current date and time. Time and date can be manipulated by using these functions. 02 Nov - PHP checkdate() Function 02 Nov - PHP date() Function 02 Nov - PHP date_add() Function 02 Nov - PHP date_create() Function 02 Nov - PHP date_date_set()...
2 min read
This function returns the default timezone. It is used by all the date and time functions of the PHP. Note : timezone will be returned as a string. Syntax string date_default_timezone_get ( void ) Return This function returns a string. Example 1 <?php echo date_default_timezone_get(); ?> Output: UTC Example 2 <?php ...
1 min read
This function is used to provide the complete information of a particular date in a specified format and an associative array is returned by it. Syntax date_parse_from_format(format,date); Parameters Parameter Description Required/Optional Format Specifies the format required Date specifies a date required Return This function returns associative array with detailed info about given date. Example 1 <?php print_r(date_parse_from_format("mmddyyyy","05122018")); ?> Output: Array ( [year] => [month] =>...
1 min read
This function is used when a certain amount of time is added or subtracted from the standard UTC to get the current civil time that had been already set on DST(daylight saving time). Syntax int date_offset_get ( DateTime $object ) Parameters Parameter Description Required/Optional Object Specifies a DateTime object Required Return This function returns DST offset...
1 min read
The PHP time() function is used to return the current time as a UNIX timestamp. This function would work by our server time and can be formatted easily. Syntax int time ( void ) Example 1 <?php $today=time(); echo($today . "\n"); echo(date("Y-m-d",$today)); ?> Output: 1533574329 2018-08-06 Example 2 <?php $time1 = time(); echo($time1); echo "\n"; echo(date("F d, Y h:i:s A", $time1)); ...
1 min read
The PHP microtime() function is used to returns the current Unix timestamp with microseconds. Float value is return by this function. Syntax mixed microtime ([ bool $get_as_float = FALSE ] ) Parameters Parameter Description Required/Optional get_as_float specifies that the function should return a float optional Return This function returns a string in the form "msec sec",...
1 min read
The gmmktime() function is used to find the day of that particular date. It returns the returns the Unix timestamp for a GMT date. Syntax int gmmktime(hour,minute,second,month,day,year,is_dst); Parameters Parameter Description Required/Optional Hour Specifies the hour optional Minute Specifies the minute optional Second Specifies the second optional Month Specifies the month optional Day Specifies the day optional Year Specifies the year optional Is_dst specifies a GMT date optional Return This function returns an integer Unix...
1 min read
It is used to set a new date and formatting of date is also allowed. It returns a datetime object. Syntax void date_date_set ( DateTime $object, int $year, int $month, int $day ); Parameters Parameter Description object Required. Specifies a DateTime object returned year Required. Specifies the year of the date month Required. Specifies the month...
1 min read
The PHP timezone_version_get() function is used to get the version of the timezone . Syntax string timezone_version_get ( void ) Return This function returns a string. Example <?php echo timezone_version_get(); ?> Output: 0.system TopicJava Methods List ...
1 min read
The gmdate() function is used to changethe GMT/UTC date and time and output is returned in form of data string. It also modifies the date and time format in readable form. Syntax string gmdate ( string $format [, int $timestamp = time() ] ) Parameters Parameter Description Required/Optional Format Specifies the format of...
1 min read
We request you to subscribe our newsletter for upcoming updates.
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India