Code Monkey home page Code Monkey logo

stime's Introduction

stime

包含两个函数

There are two functions

GetTime:获取一个时间范围的第一秒和最后一秒,可用于筛选查询,也可直接作为GetStringTime的参数

GetTime: Gets the first and last seconds of a time range, which can be used to filter queries, or can be used directly as a parameter to GetStringTime

startTime, enTime := stime.GetTime(stime.SEVENDAYS)

GetStringTime:获取一个时间范围中每一天的字符串数据组成的数组,可用于前端展示图表

GetStringTime: Gets an array of string data for each day in the time range that can be used to display a chart at the front end

var stringTimeList = make([]string, 0)
stringTimeList := stime.GetStringTime(stime.GetTime(stime.SEVENDAYS))

预设的时间范围有:今天【到现在】、今天【全天】、昨天、近七天、近30天、本月【到现在】、上月

The preset time range is: Today [to the present], today [all day], yesterday, nearly seven days, nearly 30 days, this month [to the present], last month

const (
	_          = iota
	YESTERDAY  //昨天1
	SEVENDAYS  //近七天2
	THIRTYDAYS //近30天3
	THISMONTH  //本月4
	LASTMONTH  //上月5
	TODAY      //今天6
	FULLTODAY  //今天全天7
) //取的时间参数

代码很简单,如果想要修改输出或者调整字符串格式可以自己动手~

The code is simple and you can do it yourself if you want to modify the output or reformat the string~

stime's People

Contributors

zxxshaycormac avatar

Stargazers

 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.