first commit
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<script>
|
||||
function formatDate(date) {
|
||||
console.log(date);
|
||||
date=date.replace(/-/g,'');
|
||||
console.log(date);
|
||||
// date = new Date();
|
||||
date = new Date(Date.parse(date.replace(/-/g, "/"))); //转换成Data();
|
||||
console.log(date);
|
||||
var y = date.getFullYear();
|
||||
console.log(y);
|
||||
var m = date.getMonth() + 1;
|
||||
m = m < 10 ? '0' + m : m;
|
||||
var d = date.getDate();
|
||||
d = d < 10 ? ('0' + d) : d;
|
||||
return y + '-' + m + '-' + d;
|
||||
}
|
||||
|
||||
formatDate('2020-02-02');
|
||||
|
||||
var a = ""
|
||||
function aa() {
|
||||
a="hh"
|
||||
}
|
||||
aa() // 注意,aa() 一定要执行,局部赋值全局变量才会有作用
|
||||
alert(a)
|
||||
</script>
|
||||
Reference in New Issue
Block a user