How to use the PHP function Date () _ PHP Tutorial

Source: Internet
Author: User
Describes how to use the Date () function in PHP. We want to compile the first PHP function Date () to get the current time code :? Phpecho $ showtimedate (Y-m-dH: I: s );? Display format: year-month-day hour: minute: second 2, PHP5 PH we want to write in I. PHP function Date () to get the current time

Code:

 
 
  1. php echo $showtime=date("Y-m-d H:i:s");?>

Format: year-month-day hour: minute: Second

II. solution to the eight-hour time difference obtained by The PHP function Date () in PHP5

You only need to add a definition before the output Time: date_default_timezone_set ("PRC");, code:

 
 
  1. php
  2. date_default_timezone_set("PRC");
  3. echo date("Y-m-d H:i:s");
  4. ?>

The above is the related knowledge about the PHP function Date (). I hope it will be helpful to you.


Lifecycle 1. PHP function Date () to get the current time code :? Php echo $ showtime = date ("Y-m-dH: I: s ");? Display format: year-month-day hour: minute: second 2, PHP5 in PH...

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.