PHP mktime() Function6 Jan 2025 | 1 min read The PHP mktime() function is used to find the day of that particular date. It returns the Unix timestamp for a date. SyntaxParameters
ReturnThe mktime() function returns the Unix timestamp of the arguments given. This function returns FALSE, if the arguments are invalid. Example 1Output: Aug 6, 2018 was on a Monday. Example 2Output: Jan-05-2002 Feb-01-2002 Jan-01-2001 Jan-01-1999 Example 3Output: Last day in Feb 2000 is: 29 Last day in Feb 2000 is: 29 Next TopicPhp-strftime-function |
This date_sunrise() function is used to get the timing of sunrise of a particular day and location. This function returns the sunrise time of different locations. Syntax mixed date_sunrise ( int $timestamp [, int $format [, float $latitude [, float $longitude [, float $zenith...
1 min read
The PHP timezone_location_get() function is used to show the information of the location of the given timezone. Syntax timezone_location_get(object); Parameters Object: It specifies a DateTimeZone object. Return Returns array on success or FALSE on failure. Example 1 <?php $timezone=timezone_open("Asia/Taipei"); print_r(timezone_location_get($timezone)); ?> Output: Array ( [country_code] => TW [latitude] => 25.05 ...
1 min read
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
shows day, month and year altogether. Date and time are stored in computer in UNIX Timestamp format. It calculates time in number of seconds on GMT (greenwich mean time) i.e started from January 1, 1970, 00:00:00 GMT. Syntax string date ( string $format [, int $timestamp...
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
The gettimeofday() function is used to get the current time of the day. It returns a float value. Syntax mixed gettimeofday ([ bool $return_float = FALSE ] ) Parameters Parameter Description Required/Optional return_float Specifies a float value optional Return This function by default returns an array. If return_float is set, this function will return a float. Example...
1 min read
PHP date_interval_format() for formatting the interval, this function is used in the script. We can also write it as DateInterval::format(). Syntax DateInterval::format(format); Note: Here format is the required string. Return This function returns the formatted interval. Example 1 <?php $date1=date_create("2018-01-01"); $date2=date_create("2018-02-10"); $diff=date_diff($date1,$date2); echo $diff->format("Total number of days: %a."); echo "\n"; echo $diff->format("Total number of days: %R%a."); echo "\n"; echo $diff->format("Month:...
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
The PHP timezone_identifiers_list() function is used to show an indexed array that contains all the identifiers of timezone. Syntax array timezone_identifiers_list(what,country); Parameters Parameter Description Required/Optional what Specifies a DateTimeZone optional country Specifies a country code optional Return Values This function returns array on success or FALSE on failure. Example 1 <?php // Print all timezones in Africa print_r(timezone_identifiers_list(1)); ?> Output: Array ( [0] =>...
3 min read
This getdate() function is used to get the information of the current local date/time or the timestamp. Syntax array getdate ([ int $timestamp = time() ] ) Parameters Parameter Description Required/Optional timestamp Specifies an integer optional Return This function returns an associative array of information related to the timestamp. Example 1 <?php $todaydate=getdate(date("U")); echo "$todaydate[weekday], $todaydate[month] $todaydate[mday], $todaydate[year]"; ?> Output: Thursday, August 2,...
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