Base level-Date of PHP && JS

Source: Internet
Author: User
    • Introduced
    • Specific introduction
      • PHP Date
      • JS Date

Introduced

This article describes the use of the date of PHP and JS.

Specific introduction

Today's difficulty is the date output 24-hour time, for this weak link, make a simple note.

PHP Date ()

PHP date () output 24-hour time method:echo date("Y-m-d H:i:s");
Method for outputting 12-hour Time:echo date("y-m-d h:i:s");
The main difference between uppercase and lowercase is that integrity, for example, H h corresponds to a 24/12-hour system.

The following code:

echo date("Y-m-d H:i:s")."
";echo date("y-m-d h:i:s");

The output to the browser is:

2014-03-01 14:09:1514-03-01 02:09:15

JS Date ()

The JS object for processing time, including a variety of processing time methods, simple.
Code blocks for common methods:

//①:document.write(Date())var d=newDate()var day=d.getDate()var1//注:该方法返回0~11var year=d.getFullYear()//②"/""/" + day)

The result block corresponding to the output (please check the number of rows, so as to facilitate reading):

①:Fri May 13 2016 18:55:34 GMT+0800 (中国标准时间)②:2016/4/13

Resources
PHP date () output 24-hour or 12-hour system
JavaScript Date Object-The

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the basic level-Date of PHP && JS, including the date,php aspect of the content, I hope to be interested in PHP tutorial friends helpful.

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