<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript">// 获取当前时间戳(以s为单位)var timestamp = Date.parse(new Date()); timestamp = timestamp / 1000;//当前时间戳为:1403149534console.log("当前时间戳为:" + timestamp);// 获取某个时间格式的时间戳var stringTime = "2014-07-10 10:21:12";var timestamp2 = Date.parse(new Date(stringTime)); timestamp2 = timestamp2 / 1000;//2014-07-10 10:21:12的时间戳为:1404958872 console.log(stringTime + "的时间戳为:" + timestamp2);// 将当前时间换成时间格式字符串var timestamp3 = 1403058804;var newDate = new Date(); newDate.setTime(timestamp3 * 1000);// Wed Jun 18 2014 console.log(newDate.toDateString());// Wed, 18 Jun 2014 02:33:24 GMT console.log(newDate.toGMTString());// 2014-06-18T02:33:24.000Zconsole.log(newDate.toISOString());// 2014-06-18T02:33:24.000Z console.log(newDate.toJSON());// 2014年6月18日 console.log(newDate.toLocaleDateString());// 2014年6月18日 上午10:33:24 console.log(newDate.toLocaleString());// 上午10:33:24 console.log(newDate.toLocaleTimeString());// Wed Jun 18 2014 10:33:24 GMT+0800 (中国标准时间)console.log(newDate.toString());// 10:33:24 GMT+0800 (中国标准时间) console.log(newDate.toTimeString());// Wed, 18 Jun 2014 02:33:24 GMTconsole.log(newDate.toUTCString()); Date.prototype.format = function(format) { var date = { "M+": this.getMonth() + 1, "d+": this.getDate(), "h+": this.getHours(), "m+": this.getMinutes(), "s+": this.getSeconds(), "q+": Math.floor((this.getMonth() + 3) / 3), "S+": this.getMilliseconds() }; if (/(y+)/i.test(format)) { format = format.replace(RegExp.$1, (this.getFullYear() + '').substr(4 - RegExp.$1.length)); } for (var k in date) { if (new RegExp("(" + k + ")").test(format)) { format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? date[k] : ("00" + date[k]).substr(("" + date[k]).length)); } } return format; } console.log(newDate.format('yyyy-MM-dd h:m:s'));</script>
javascript时间戳和日期字符串相互转换
-
git本地覆盖远程方法
git push origin master --force
-
详解vue2.6插槽更新v-slot用法总结
在 2.6.0 中,我们为具名插槽和作用域插槽引入了一个新的统一的语法 (即 v-slot 指令)。这篇文章主要介绍了详解vue2.6插槽更新v-slot用法总结,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
-
CSS3 Transition详解和使用
Transition 可以设置 CSS 属性的过渡效果,它有以下几个属性。 transition-property 用于指定应用过渡属性的名称 transition-duration 用于指定这个过渡的持续时间 transition-delay 用于指定延迟过渡的时间 transition-timing-function 用于指定过渡的类型 transition-property transition-property 用于指定应用过渡的属性名称,可以指定多个属性名称,多个属性名称之间用, 分隔。 默认值为 all 也就是所有的元素都应用过渡效果。 例如,想让容器的宽高有一个过渡的效果,就可以这样写:
-
mac os系统复制粘贴ctrl+c ctrl+v快捷键实现方式
平时用习惯了win系统,用mac os时,复制粘贴不习惯使用command+c command+v。那么怎么把mac os的系统设置成ctrl+c和ctrl+v呢?
-
android.widget.LinearLayout$LayoutParams cannot be cast to android.widget.RelativeLayout$LayoutPara
解决方法:ImageView是LinearLayout的子控件,它的LayoutParams 应该是LinearLayout给他的。所以应该是LinearLayout.LayoutParam 。
-
java标记过期方法
java注解:@Deprecated(不建议使用的,废弃的);@SuppressWarnings(忽略警告,达到抑制编译器产生警告的目的)
-
dispatch ,commit区别在vue store
dispatch: 含有异步操作,commit:同步操作
-
使用.htaccess重定向后无法显示图片,CSS失效,该如何处理
现在我需要把这个域名泛解析到blog目录(*.mydomain.org),同时保持另外两个目录的解析不变。尝试对最后一段作以下修改后(前面的内容不变),出现问题:另两个目录中的网站内的图片无法显示,CSS全部失效。
-
vue中的this指向问题
※ 对于普通函数(包括匿名函数),this指的是直接的调用者,在非严格模式下,如果没有直接调用者,this指的是window。showMessage1()里setTimeout使用了匿名函数,this指向 window。 ※ 箭头函数是没有自己的this,在它内部使用的this是由它定义的宿主对象决定。showMessage2()里定义的箭头函数宿主对象为vue实例,所以它里面使用的this指向vue实例。
-
Spring boot 设置null不返回值
springboot解决实体类值为null或者数组为空,不返回前台的解决方案