JavaScript获取当前时间戳的方法

栏目: 编程语言 · JavaScript · 发布时间: 8年前

内容简介:JavaScript获取当前时间戳的方法

JavaScript获取当前时间戳的方法

第一种方法:

var timestamp = Date.parse(new Date());

结果:1280977330000

第二种方法:

var timestamp = (new Date()).valueOf();

结果:1280977330748

第三种方法:

var timestamp=new Date().getTime();

结果:1280977330748

第一种:获取的时间戳是把毫秒改成000显示,

第二种和第三种是获取了当前毫秒的时间戳。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

An Introduction to Genetic Algorithms

An Introduction to Genetic Algorithms

Melanie Mitchell / MIT Press / 1998-2-6 / USD 45.00

Genetic algorithms have been used in science and engineering as adaptive algorithms for solving practical problems and as computational models of natural evolutionary systems. This brief, accessible i......一起来看看 《An Introduction to Genetic Algorithms》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

URL 编码/解码
URL 编码/解码

URL 编码/解码

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具