Time Stamp JS PHP MYSQL

Source: Internet
Author: User
Tags php mysql

Unix Timestamp unix Timestamp (the number of seconds after ' 1970-01-01 00:00:00 ' GMT)

Js

var strtime = ' 2014-04-23 18:55:49:123 '; var New // Pass in a time format date.gettime ();  // Change to UNIX timestamp except for 

Php

$ts  Time // Current time stamp int $ti Date $ts // date and time in RFC 2822 format, $TF Date // custom Format, the second parameter is the default current timestamp//followed by two is a string $ts Strtotime // String Conversion Time

Mysql

Timestamp field representation is more like a string

SELECTDate from Table //php read out date is a stringINSERT Table SetDate='2017-11-2 10:10:10'UPDATE Table SetDate='2017-11-2 10:10:10' whereId=1  ///Two field input is a string, PHP use the date function to pass after the conversion

Use:

1. MySQL takes out the string:

1, can directly through the JS can directly convert the date into JS timestamp

2, with PHP strtotime loaded with time stamp, JS *1000 to replace JS timestamp

2, JS pass time stamp, PHP with date loaded into string, to MySQL

See

PHP MySQL http://www.cnblogs.com/mitang/p/3603823.html

JS http://www.cnblogs.com/mitang/p/5605712.html

PHP Date http://php.net/manual/zh/function.date.php

PHP strtotime http://php.net/manual/zh/function.strtotime.php

Time stamp JS PHP MYSQL

Related Article

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.