Home  >  Article  >  Web Front-end  >  How does JavaScript calculate time difference (introducing external font files)?

How does JavaScript calculate time difference (introducing external font files)?

青灯夜游
青灯夜游Original
2018-09-13 17:14:411560browse

This chapter will show you how to calculate the time difference (introducing external font files) using JavaScript? It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

JavaScript Date() object:

new Date(): time object, which will use the current time as its initial value;

SetFullYear(): used to set the month, can have three parameters, setFullYear(year,month,day);

setHours(): set the hour of the specified time, can have four parameters, setHours( hour, min, sec, millisec);

GetDate(): Returns a certain day of the month;

getMonth(): Returns the number representing the month;

getFullYear() : Returns a 4-digit number representing the year;

GetTime() : Returns the number of milliseconds from January 1, 1970;

setFullYear() : Sets the year;

SetDate(): Set the day;

Code example:

css code:

@font-face{
            font-family: "Digital-7 Mono";
            src: url('Digital-7Mono.TTF');
        }
        div{
            width: 500px;
        } 
       .contain{
            text-align: right;
            font-size: 18px;
            margin-top: 10px;
            margin-bottom: 10px;
        }
        .contain span{
            font-family: "Digital-7 Mono";
            font-size: 36px;
            color: #555;
            padding-left: 10px;
        }

HTML code:

js code:


No need to install it locally, directly reference the external font file

@font-face{
            font-family: "Digital-7 Mono";
            src: url('Digital-7Mono.TTF');
        }

URL is the path of the file

The above is the detailed content of How does JavaScript calculate time difference (introducing external font files)?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn