Ad display judgment _ ad code

Source: Internet
Author: User
Ad display judgment Detection advertisement display judgment function seen from Sina

The Code is as follows:


Script
Pagepubtime = "2006-08-31 ";
// Ad display judgment
Function checkPubTime (){

// Year, month, and day
DateTime = new Array ();
DateTime = pagepubtime. split ("-");
Var year = DateTime [0];
Var month = DateTime [1];
Var day = DateTime [2];

// Use the year, month, or day to generate a date object.
Var pubTime = new Date (year, month-1, day );
// Obtain the current date
Var now = new Date ();

// Calculate the millisecond difference between the current date and the release date
Var dif = now. getTime ()-pubTime. getTime ();

// Date difference to be detected
Var difDay = 180;

// 24 hours per day, 60 minutes per hour, 60 seconds per minute, 1000 milliseconds per second
If (dif> difDay * 24*60*60*1000)
{
Return false;
}
Return true;
}

SCRIPT
//

SCRIPT

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.