Giter Site home page Giter Site logo

dateformat's Introduction

dateFormat

参数描述

var option ={ time: '2017-08-31 16:31:02', type: ['/', '/'], formatYear: false, formatDate: true } time为需要转换的时间,格式可以是时间戳or时间字符串
type为需要转换的格式类型,需是array,如需显示2017年08月01日格式,则传['年','月','日'],如需显示2017-08-01格式,则传['-','-','-'],如需显示2017/08/01格式,则传['/','/']
formatYear为是否显示年月日,需是bool,true显示,false不显示
formatDate为是否显示时分秒,需是bool,true显示,false不显示
formatYear && formatYear 同时为true,则显示年月日 时分秒默认这两个值可以不传

安装步骤

step npm i lotusformat --save or yarn add lotusformat

如何使用

var forMatDate = require("lotusdateformat");
1.显示时分秒 如:11:29:10
forMatDate({ formatDate: true });
2.显示年月日 如:2017-08-31
forMatDate({ time: '2017-08-31 16:31:02', formatYear: true });
3.显示年月日 如:2017年08月31日
forMatDate({ time: '2017-08-31 16:31:02', type: ['年', '月', '日'], formatYear: true });
4.显示年月日时分秒 如:2017/08/31 16:31:02
forMatDate({ time: '2017-08-31 16:31:02', type: ['/', '/'] });
5.显示年月日时分秒 如:2017-09-01 11:29:10
forMatDate();
6.显示年月日时分秒 如:2017年09月01日 16:31:02
forMatDate({ time: '2017-9-1 16:31:02', type: ['年', '月', '日'] });

dateformat's People

Contributors

winglau14 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.