Ask the hero to help. How does PHP count the number of new members added this week?

Source: Internet
Author: User
Php

There is a member of the table A
-------------
User Addtime
WLM 1372938746
---------------------
How do you count the numbers of new members that were added this week from Monday to Sunday? Addtime is a character timestamp

The foreigner seems to have changed the time, they think the week is different from ours, we all started in Monday. This is a bit of a hassle.


Reply to discussion (solution)

or in the PHP program to calculate the starting time, to cross-database query
or use the date-processing function provided by the database to calculate directly

or in the PHP program to calculate the starting time, to cross-database query
or use the date-processing function provided by the database to calculate directly

Exactly how to do it.

For example, the time stamp for this Monday is
$t = Strtotime (' 2003-07-15 '); 1058198400
So, your query condition is
addtime>= ' $t '

New members will go to record a new time, according to the time to judge. SELECT * from user where fst_date>= '. $createtime. ';

"SELECT * FROM Table a wehre addtime>= '". Strtotime (' 2003-07-15 '). "'"

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