1 Star 1 Fork 0

ThinkingAndCoding/css-demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dateTest.html 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
夕川 提交于 2019-09-20 14:11 . feat: 添加一些示例文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Date Test</title>
</head>
<body>
<script>
function format(data){
const dateTime =new Date(data)
const [year, month, day, date] = [
dateTime.getFullYear(),
dateTime.getMonth(),
dateTime.getDate(),
dateTime.getDay()
];
const payTimeArr = [
{
min: new Date(year,month,day).getTime() / 1000,
max: new Date(year,month,day+1).getTime() / 1000-1
}, // 今天
{
min: new Date(year,month,day-1).getTime() / 1000,
max: new Date(year,month,day).getTime() / 1000 - 1
}, // 昨天
{
min: new Date(year,month,day-date).getTime() / 1000,
max: new Date(year,month,day-date+7).getTime() / 1000-1
}, // 本周
{
min: new Date(year,month,day-date-7).getTime() / 1000,
max: new Date(year,month,day-date).getTime() / 1000-1
}, // 上周
{
min: new Date(year,month,1).getTime() / 1000,
max: new Date(year,month,day+1).getTime() / 1000 -1
}, // 本月
{
min: new Date(year,month - 1,1).getTime() / 1000,
max: new Date( year,month,1).getTime() / 1000 -1
} // 上月
];
console.log(payTimeArr);
return payTimeArr
}
format("2019-1-1");
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/WangShuaiCode/css-demo.git
git@gitee.com:WangShuaiCode/css-demo.git
WangShuaiCode
css-demo
css-demo
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385