转自:http://www.feiesoft.com/00047/
<script type="text/javascript">
// JS Date当前时间获取方法在各浏览器中的差异
// 当前时间:
var dt = new Date();
// Date([datetime])构造函数初始化对象时不输入参数 [datetime] ,则以用户本地电脑上的时间初始化 dt。
// dt 是一个 JS Date对象,在字符串环境下输出当前时间标准格式串,即此时自动调用 dt 对象的toString()方法(注:在JS中,任何对象都有一个 toString()方法,用于输出一些关于对象直观上的文本表述。)。
// 例:
document.writeln(dt);
document.writeln(dt.toString());
// 各浏览器输出:
//
// 微软 IE10 浏览器: Sat Nov 2 03:48:58 UTC+0800 2013
// 谷歌 Chrome 浏览器:Sat Nov 02 2013 04:07:03 GMT+0800 (中国标准时间)
// 奇虎360安全浏览器:Sat Nov 02 2013 03:49:54 GMT+0800 (中国标准时间)
// Firefox 25.0 火狐浏览器:Sat Nov 02 2013 03:55:02 GMT+0800
//
//日期、时间
document.writeln(dt.toLocaleString());
//
// 微软 IE10 浏览器: 2013年11月2日 4:15:55
// 谷歌 Chrome 浏览器:2013年11月2日 上午4:15:43
// 奇虎360安全浏览器:Sat Nov 02 2013 04:16:41 GMT+0800 (中国标准时间)
// Firefox 25.0 火狐浏览器:2013年11月2日 4:18:30
//
//在地日期:
document.writeln(dt.toLocaleDateString());
//
// 微软 IE10 浏览器: 2013年11月2日
// 谷歌 Chrome 浏览器:2013年11月2日
// 奇虎360安全浏览器:Saturday, November 02, 2013
// Firefox 25.0 火狐浏览器:2013年11月2日
//
//在地时间:
document.writeln(dt.toLocaleTimeString());
//
// 微软 IE10 浏览器: 4:20:04
// 谷歌 Chrome 浏览器:上午4:20:06
// 奇虎360安全浏览器:04:20:08
// Firefox 25.0 火狐浏览器:04:20:08
//
// 如果要得到“YYYY年MM月DD日 HH:mm:SS”格式的当前时间值,强烈推荐用:
//
document.writeln(dt.getFullYear() + "年" + dt.getMonth() + "月" + dt.getDate() + "日 " + dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds());
</script>

最新文章

  1. 微软发布VSBT,无需安装Visual Studio即可实现项目编译
  2. 如何为Swift进行宏定义
  3. REST服务返回自定义的HttpResponseMessage
  4. SDAccel-FPGA将带来至多25倍单位功耗性能提升
  5. php——n维数组的遍历——递归
  6. POJ 1679 The Unique MST (次小生成树)
  7. Construct Binary Tree From Inorder and Preorder/Postorder Traversal
  8. Microsoft Deployment Toolkit 2013 Preview Release Now Available
  9. Hadoop集群的安装与配置(centos 6.5)
  10. HBase Rowkey 设计指南
  11. 转:Log Explorer使用说明恢复被误删除的数据
  12. Change upload file limit in specified Webapllication in SharePoint (PowerShell)
  13. Scala:HelloWorld
  14. js堆和栈
  15. 洛谷P2564 生日礼物【单调队列】
  16. Windows 平台安装 MongoDB
  17. Hadoop集群维护
  18. [C#]INI文件控制类
  19. 用SQL查询方式显示GROUP BY中的TOP解决方法[转]
  20. 早该知道的7个JavaScript技巧

热门文章

  1. centos7下安装nodejs
  2. oracle xmltype导入并解析Excel数据 (四)特别说明
  3. Thinkphp_基础(2)URL模式
  4. appium+Python真机运行测试demo的方法
  5. JMS总结
  6. Python——Day3知识点——文件操作
  7. Redis中struct运用
  8. 07——为多态基类声明为virtual析构函数
  9. 解决python字典结构内存暴涨问题
  10. 使用navigator.geolocation来获取用户的地理位置信息