PHP checkdate() function6 Jan 2025 | 1 min read This function clears the date and year exit or not. SyntaxParameters
ReturnThis function returns TRUE if the date given is valid; otherwise returns FALSE. Example 1Output: bool(false) bool(false) bool(true) Example 2Output: bool(true) Example 3Output: bool(true) bool(false) Next TopicPhp-date-function |
This date_sunset() function is used to get the timing of sunset of a particular day and location. This function returns the sunset time of different locations. Syntax mixed date_sunset ( int $timestamp [, int $format = SUNFUNCS_RET_STRING [, float $latitude = ini_get("date.default_latitude") [, float $longitude = ini_get("date.default_longitude")...
1 min read
This PHP localtime() function is used to print the time in the form of indexed and associative array. It returns the local time. Syntax localtime(timestamp,is_assoc); Parameters Parameter Description Required/Optional timestamp Specifies a Unix timestamp optional Is_assoc Specifies whether to return an associative array or indexed array. optional Example 1 <?php print_r(localtime()); echo "<br><br>"; print_r(localtime(time(),true)); ?> Output: Array ( [0] => 45 ...
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
The strftime() function is used to set the date and time according to the local settings . It formats the GMT/UTC date and time. Syntax string strftime ( string $format [, int $timestamp = time() ] ) Parameters Parameter Description Required/Optional Format Specifies how to return the result required Timestamp Specifies a Unix timestamp optional Return This function returns...
1 min read
This PHP timezone_abbreviations_list() function is used to return an associative array that contains the timezone name, offset and the dst. Syntax array timezone_abbreviations_list(); Return This function returns array on success or FALSE on failure. Example 1 <?php $timezone_abbreviations = timezone_abbreviations_list (); print_r($timezone_abbreviations["acst"]); echo "----------------------------------------------\n"; # Using...
9 min read
This function allows the modification in date and time. Syntax date_modify(object,modify); Parameters Parameter Description Required/Optional object Specifies a DateTime object return. Required modify Specifies a date/time string Required Return This function returns NULL on success or FALSE on failure. Example 1 <?php $date=date_create("2018-05-01"); date_modify($date,"+15 days"); echo date_format($date,"Y-m-d"); ?> Output: 2018-05-16 Example 2 <?php $date = new DateTime("2020-12-12"); $date->modify("+10 day"); echo $date->format("Y-m-d"); ?> Output: 2020-12-22 Example 3 <?php ...
1 min read
The date_timestamp_set() function is used to set the date and time based on unix timestamp. It returns a datetime object and unix timestamp represents the date. Syntax date_timestamp_set(object,unixtimestamp); Parameters Parameter Description Required/Optional object Specifies a DateTime object required unixtimestamp Specifies a Unix timestamp representing the date optional Example 1 <?php $date1=date_create(); date_timestamp_set($date1,1533132945); echo date_format($date1,"U = Y-m-d H:i:s"); ?> Output: 1533132945 = 2018-08-01 14:15:45 Example 2 <?php $date=date_create(); date_timestamp_set($date,1533133630); echo date_format($date,"U...
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
The date_sun_info() function is used to return all the information about twilight begin/end and sunset/sunrise time for a specific time and location. Syntax array date_sun_info ( int $time , float $latitude , float $longitude ) Note :here value of latitude is 31.7667 and longitude is 35.2333. Parameters Parameter Description Required/Optional timestamp Specifies a timestamp Required latitude Specifies...
1 min read
This PHP timezone_open() function is used to return the name of the timezone and also create a new DateTimeZone object. Syntax timezone_open ( $timezone ) Parameters timezone: It specifies a timezone. Return This function returns the DateTimeZone object on success or FALSE on failure. Example 1 <?php $timezone=timezone_open("Europe/Paris"); echo timezone_name_get($timezone); ?> Output: Europe/Paris Example 2 <?php $timezone=timezone_open("Europe/Oslo"); echo timezone_name_get($timezone); ?> Output: Europe/Oslo TopicPhp-timezone-version-get-function ...
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