PHP date_date_set() function6 Jan 2025 | 1 min read It is used to set a new date and formatting of date is also allowed. It returns a datetime object. SyntaxParameters
ReturnIt returns NULL on success or FALSE on failure. Example 1Output: 2022/01/20 Example 2Output: 2018-02-28 2011-03-01 2016-04-03 Example 3Output: 2018-02-03 Next TopicPhp-date-default-timezone-get-function |
This function sets the default timezone. It is used by all the date and time functions of the PHP. Syntax bool date_default_timezone_set ( string $timezone_identifier ) Parameters timezone_identifier: The timezone identifier like UTC or Europe/Lisbon. The list of valid identifiers is available in the List of Supported Timezones. Return This function...
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
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 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 date_timestamp_get() function is used to return the Unix timestamp for today's date and time. Syntax date_timestamp_get(object); 0r DateTime::getTimestamp() Parameters Parameter Description Required/Optional object Specifies a DateTime object required Example 1 <?php $date=date_create(); echo date_timestamp_get($date); ?> Output: 1533132945 Example 2 <?php $date = new DateTime(); echo $date->getTimestamp(); ?> Output: 1533133630 TopicPhp-date-timezone-get-function ...
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
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
The is used to show name of timezone from the abbreviation. Syntax timezone_name_from_abbr( $abbr [, $gmtOffset [, $is_dst]] ); Parameters Parameter Description Required/Optional abbr Specifies the timezone abbreviation required gmtoffseet Specifies the offset from GMT in seconds optional Is_dt Specifies daylight saving time indicator. optional Return This function returns the time zone name on success or FALSE on failure. Example 1 <?php echo timezone_name_from_abbr("EST")...
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 PHP timezone_offset_get() function is used to show the offset of the timezone from the GMT. Syntax int timezone_offset_get ( $object, $datetime ); Parameters Parameter Description Required/Optional object Specifies a DateTimeZone object required datetime Specifies a date/time required Return This function returns time zone offset in seconds on success or FALSE on failure. Example 1 <?php $timezone=timezone_open("Asia/Taipei"); $dateTimeOslo=date_create("now",timezone_open("Europe/Oslo")); echo timezone_offset_get($timezone,$dateTimeOslo); ?> Output: 28800 Example 2 <?php $timezone=timezone_open("Africa/Juba "); $dateTimeAmsterdam=date_create("now",timezone_open("Europe/Amsterdam ")); echo...
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