PHP27-PHP Date / Time Functions

PHP Date / Time Introduction The date/time functions allow you to extract and format the date and time on the server. Note: These func...

PHP Date / Time Introduction

The date/time functions allow you to extract and format the date and time on the server.
Note: These functions depend on the locale settings of the server!

Installation

The date/time functions are part of the PHP core. There is no installation needed to use these functions.

Runtime Configuration

The behavior of the date/time functions is affected by settings in php.ini.
Date/Time configuration options:

Name Default Description Changeable
date.default_latitude  "31.7667" Specifies the default latitude (available since PHP 5). This option is used by date_sunrise() and date_sunset() PHP_INI_ALL
date.default_longitude "35.2333" Specifies the default longitude (available since PHP 5). This option is used by date_sunrise() and date_sunset() PHP_INI_ALL
date.sunrise_zenith "90.83" Specifies the default sunrise zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset() PHP_INI_ALL
date.sunset_zenith "90.83" Specifies the default sunset zenith (available since PHP 5). This option is used by date_sunrise() and date_sunset() PHP_INI_ALL
date.timezone "" Specifies the default timezone (available since PHP 5.1) PHP_INI_ALL


PHP Date / Time Functions

PHP: indicates the earliest version of PHP that supports the function.

Function Description PHP
checkdate() Validates a Gregorian date 3
date_default_timezone_get() Returns the default time zone 5
date_default_timezone_set() Sets the default time zone 5
date_sunrise() Returns the time of sunrise for a given day / location 5
date_sunset() Returns the time of sunset for a given day / location 5
date() Formats a local time/date 3
getdate() Returns an array that contains date and time information for a Unix timestamp 3
gettimeofday() Returns an array that contains current time information 3
gmdate() Formats a GMT/UTC date/time 3
gmmktime() Returns the Unix timestamp for a GMT date 3
gmstrftime() Formats a GMT/UTC time/date according to locale settings 3
idate() Formats a local time/date as integer 5
localtime() Returns an array that contains the time components of a Unix timestamp 4
microtime() Returns the microseconds for the current time 3
mktime() Returns the Unix timestamp for a date 3
strftime() Formats a local time/date according to locale settings 3
strptime() Parses a time/date generated with strftime() 5
strtotime() Parses an English textual date or time into a Unix timestamp 3
time() Returns the current time as a Unix timestamp 3


PHP Date / Time Constants

PHP: indicates the earliest version of PHP that supports the constant.

Constant Description PHP
DATE_ATOM Atom (example: 2005-08-15T16:13:03+0000)  
DATE_COOKIE HTTP Cookies (example: Sun, 14 Aug 2005 16:13:03 UTC)  
DATE_ISO8601 ISO-8601 (example: 2005-08-14T16:13:03+0000)  
DATE_RFC822 RFC 822 (example: Sun, 14 Aug 2005 16:13:03 UTC)  
DATE_RFC850 RFC 850 (example: Sunday, 14-Aug-05 16:13:03 UTC)  
DATE_RFC1036 RFC 1036 (example: Sunday, 14-Aug-05 16:13:03 UTC)  
DATE_RFC1123 RFC 1123 (example: Sun, 14 Aug 2005 16:13:03 UTC)  
DATE_RFC2822 RFC 2822 (Sun, 14 Aug 2005 16:13:03 +0000)  
DATE_RSS RSS (Sun, 14 Aug 2005 16:13:03 UTC)  
DATE_W3C World Wide Web Consortium (example: 2005-08-14T16:13:03+0000)  
Name

ADO,131,ASP,3,C++,61,CORE JAVA,1,CSS,115,HTML,297,index,5,JAVASCRIPT,210,OS,47,PHP,65,SAD,53,SERVLETS,23,SOFTWARE ENGINEERING,245,SQL,71,TCP/IP,1,XHTML,9,XML,18,
ltr
item
Best Online Tutorials | Source codes | Programming Languages: PHP27-PHP Date / Time Functions
PHP27-PHP Date / Time Functions
Best Online Tutorials | Source codes | Programming Languages
https://www.1000sourcecodes.com/2012/10/php27-php-date-time-functions.html
https://www.1000sourcecodes.com/
https://www.1000sourcecodes.com/
https://www.1000sourcecodes.com/2012/10/php27-php-date-time-functions.html
true
357226456970214079
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content