PHP Series Learning Date function _php Tutorial

Source: Internet
Author: User
Tags echo command php language
Introduction

PHP is a very amazing language. It's strong enough (The biggest blog (WordPress) core language), it's broad enough (running on the biggest social networking site on Facebook), it's simple enough (as a beginner's preferred entry language). Works well on low-cost machines. And the PHP language has a lot of very good server suites (such as Wamp and Mamp), easy to install on your machine. PHP has a very rich library resource that makes it easy for developers to handle some business. Since we have the most contact with dates in the project, today we start with the date function.

To give a simple date example

I will use the echo command to output the content to our client (browser). I will use the following code as the base code.

 
 
  1. >
  2. < HTML lang="en">
  3. < Head >
  4. < Meta charset="utf-8" />
  5. < title > Getting started with dates in php5 title >
  6. Head >
  7. < Body >
  8. PHP
  9. Date_default_timezone_set (' Asia/shanghai ');
  10. echo "Today is", Date (' L ');
  11. ?>
  12. Body >
  13. HTML >

You will see the following content in your browser.

Today is Friday

This function outputs the text format of the day of the week. The date function requires at least one character parameter (this parameter tells us how to format the current date).

Try a different format

If you read the PHP manual,

http://www.bkjia.com/PHPjc/445660.html www.bkjia.com true http://www.bkjia.com/PHPjc/445660.html techarticle the introduction of PHP is a very surprising language. It's strong enough (The biggest blog (WordPress) core language), it's broad enough (running on the biggest social networking site on Facebook), it's full ...

  • 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.