Loading... # PHP Date/Time Functions The following section contains a list of PHP date and time functions along with a brief description. ## PHP Date and Time Functions Here is a complete list of date and time functions belonging to the latest PHP 7. These functions are the part of the PHP core so you can use them in your script without any further installation. checkdate() Validates a Gregorian date. --- date\_add() Adds an amount of days, months, years, hours, minutes and seconds to a date. --- date\_create\_from\_format() Returns a new DateTime object formatted according to the specified format. --- date\_create() Returns new DateTime object. --- date\_date\_set() Sets a new date. --- date\_default\_timezone\_get() Returns the default timezone used by all date/time functions in a script. --- date\_default\_timezone\_set() Sets the default timezone used by all date/time functions in a script. --- date\_diff() Returns the difference between two dates. --- date\_format() Returns a date formatted according to a specified format. --- date\_get\_last\_errors() Returns the warnings and errors found while parsing a date/time string. --- date\_interval\_create\_from\_date\_string() Sets up a DateInterval from the relative parts of the string. --- date\_interval\_format() Formats the interval. --- date\_isodate\_set() Set a date according to the ISO 8601 standard. --- date\_modify() Modifies the timestamp. --- date\_offset\_get() Returns the timezone offset. --- date\_parse\_from\_format() Returns an associative array with detailed info about given date formatted according to the specified format. --- date\_parse() Returns associative array with detailed info about a specified date. --- date\_sub() Subtracts an amount of days, months, years, hours, minutes and seconds from a date. --- date\_sun\_info() Returns an array with information about sunset/sunrise and twilight begin/end for a specified day and location. --- date\_sunrise() Returns time of sunrise for a given day and location. --- date\_sunset() Returns time of sunset for a given day and location. --- date\_time\_set() Sets the time. --- date\_timestamp\_get() Returns the Unix timestamp representing the date. --- date\_timestamp\_set() Sets the date and time based on an Unix timestamp. --- date\_timezone\_get() Return time zone relative to given DateTime. --- date\_timezone\_set() Sets the time zone for the DateTime object. --- date() Formats a local date and time. --- getdate() Returns date/time information of the timestamp or the current local date/time. --- gettimeofday() Returns the current time. --- gmdate() Formats a GMT/UTC date and time. --- gmmktime() Get Unix timestamp for a GMT date. --- gmstrftime() Formats a GMT/UTC date and time according to locale settings. --- idate() Formats a local time/date as integer. --- localtime() Returns the local time. --- microtime() Return the current Unix timestamp with microseconds. --- mktime() Returns the Unix timestamp for a date. --- strftime() Formats a local time/date according to locale settings. --- strptime() Parses a time/date generated with strftime(). --- strtotime() Parses an English textual datetime into a Unix timestamp. --- time() Returns the current time as a Unix timestamp. --- timezone\_abbreviations\_list() Returns associative array containing dst, offset and the timezone name. --- timezone\_identifiers\_list() Returns an indexed array containing all defined timezone identifiers. --- timezone\_location\_get() Returns the location information for a specified timezone. --- timezone\_name\_from\_abbr() Returns the timezone name from abbreviation. --- timezone\_name\_get() Returns the name of the timezone. --- timezone\_offset\_get() Returns the timezone offset from GMT. --- timezone\_open() Creates new DateTimeZone object. --- timezone\_transitions\_get() Returns all transitions for the timezone. --- timezone\_version\_get() Returns the current version of the timezonedb. Last modification:September 15, 2024 © Allow specification reprint Like 如果觉得我的文章对你有用,请随意赞赏