2021-4-12 Work Record-Template.js (Module Engine) -Stize timestamps to date

tags: Work  javascript  front end

1. Template.js (module engine) -Stize timestamp to date


The corresponding code is as follows:

template.helper('time',function (v) { 
        let d = new Date(v * 1000);// The timestamp is 10 -bit*1000, and the timestamp is 13 digits. No need to multiply 1000
        let yyyy = d.getFullYear() + '-';
        let MM = (d.getMonth() < 10 ? '0'+(d.getMonth()+1) : (d.getMonth())+1) + '-';
        let dd = (d.getDate() < 10 ? '0'+d.getDate() : d.getDate());
        return yyyy + MM + dd;
    })


result:

Intelligent Recommendation

The use of JavaScript template engine Template.js

This article mainly introduces the use of the JavaScript template engine Template.js in detail, which has certain reference value. Interested friends can refer to it template.js A JavaScript template ...

template.js-front-end template engine

1. Under what circumstances is recommendedtemplate.js (1)There are the same modules in your page layout, you can propose common modules for easy maintenance Note: The loop is used here to reduce ...

template.js template engine download and examples

definition: art-template is a simple and super fast template engine. It uses scope pre-declaration technology to optimize template rendering speed, so as to obtain running performance close to the lim...

JavaScript template engine template.js use

The article mainly introduces the use of JavaScript template engine template.js for everyone. Template.js an JavaScript template engine, simple, easy to use. Provide a template syntax, the user can wr...

JS template engine Template.js use

JS template engine Template.js use template.js source code Instructions HTML code js code Expansion usage...

More Recommendation

[2021 latest] Java timestamps and date time inter-conversion

Code: Output: If you want to encapsulate a method:...

2021-4-29 Work Record - Swiper Nested (Two Horizontal Swiper)

First, click the corresponding button, the outer SWIPER boot map slides: Second, when the boot slides, the following numbers, text and progress strips will follow: Note: Companies with HTML Third, rem...

JavaScript template engine uses detailed Template.js

template.js a JavaScript templating engine, simple and easy to use. Syntax provides a set of templates, the user can write a template block, each based on the incoming data, generates HTML data corres...

How to use js template engine art-template.js

art-template is a js template engine with excellent performancehttps://aui.github.io/art-template/ Chinese document addresshttps://aui.github.io/art-template/zh-cn/docs/ download link: https://github....

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top