PHP date_format() function6 Jan 2025 | 1 min read This function is used to return date in a specified formati.e format of year ,month and day . SyntaxParameters
ReturnThis function returns formatted date on success or FALSE on failure. Example 1Output: 2018/03/15 00:00:00 Example 2Output: 20/03/18 Next TopicPhp-date-get-last-errors-function |
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
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
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
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 PHP mktime() function is used to find the day of that particular date. It returns the Unix timestamp for a date. Syntax mktime(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 Set this parameter to 1 as DST optional Return The mktime() function returns the Unix...
1 min read
This date function work same as date_parse_from_format() that provides the complete information about the particular date in an specified format and return data in form of array. Syntax array date_parse ( string $date ) Parameters Parameter Description Required/Optional date Specifies a date Required Return This function returns array with information about the parsed date on success...
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
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 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
The gmstrftime() function is used to set the date and time according to the local settings . It formats the GMT/UTC date and time. Syntax string gmstrftime ( string $format [, int $timestamp = time() ] ) Parameters Parameter Description Required/Optional Format Specifies how to return the result required timestamp Specifies a Unix timestamp that represents...
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