Returns the Unix time stamp for the current time

Source: Internet
Author: User
Tags php tutorial

PHP time () function
PHP date/time function
Definitions and usage
The time () function returns a Unix timestamp for the current time.

Grammar
Time (void) parameter description
void Optional.

Description
Returns the number of seconds since the Unix era (GMT January 1, 1970 00:00:00) to the current time.
Tips and comments
Tip: The timestamp that originated at the time of the request was saved from PHP 5.1 in $_server[' Request_time '.
Example
Example 1
<?php Tutorial
$t =time ();
Echo ($t. "<br/>");
Echo (Date ("D F D Y", $t));
?> output:

1138618081
Mon January 30 2006 Example 2
<?php
$nextWeek = time () + (7 * 24 * 60 * 60); 7 days; Hours; mins; 60secs
Echo ' Now: '. Date (' y-m-d '). " ";
Echo ' Next Week: '. Date (' y-m-d ', $nextWeek). " ";
?> output:

Now:2005-03-30
Next week:2005-04-07

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.