为何 UNIX 时间 0, 有时显示是1970年1月1日,有时显示是1969年12月31日
http://www.rachaelarnold.com/dev/archive/why-is-date-returning-wrong
Demystifying 12/31/1969 (or 1/1/1970 for Eastern Hemisphere folk)
Since the Unix timestamp is based off the Unix Epoch, an invalid timestamp defaults to to the Epoch (Thu, 01 Jan 1970 00:00:00 +0000).
But, date() displays the formatted time taking into account the timezone of the server or a timezone set with date_default_timezone_set(), so if your timezone is set to something like America/New_York (-0500), the date will be adjusted, resulting in a time that falls during 31 Dec 1969.
So if your server or script timezone is set to a timezone in the Western Hemisphere, any invalid timestamps will end up displayed as some incarnation of 31 Dec 1969. Likewise, in the Eastern Hemisphere, the date falls on or after the Epoch, resulting in a returned value of 1 Jan 1970.
为何 UNIX 时间 0, 有时显示是1970年1月1日,有时显示是1969年12月31日的更多相关文章
- 生成二维码 加密解密类 TABLE转换成实体、TABLE转换成实体集合(可转换成对象和值类型) COOKIE帮助类 数据类型转换 截取字符串 根据IP获取地点 生成随机字符 UNIX时间转换为DATETIME\DATETIME转换为UNIXTIME 是否包含中文 生成秘钥方式之一 计算某一年 某一周 的起始时间和结束时间
生成二维码 /// <summary>/// 生成二维码/// </summary>public static class QRcodeUtils{private static ...
- UNIX时间与本地时间的转换
所谓UNIX时间,维基百科的解释:UNIX时间,或称POSIX时间是UNIX或类UNIX系统使用的时间表示方式:从协调世界时1970年1月1日0时0分0秒起至现在的总秒数,不包括闰秒 知道了是什么,就 ...
- 【測试工具】一个将Unix时间转换为通用时间的工具
一个将Unix时间转换为通用时间的工具 演示效果: 点击转换之后变为: 源码: function calctime2(){ var time = window.document.getElementB ...
- Windows FILETIME 与UNIX时间的转换
windows FILETIME时间从1601/01/01 零时零分零秒开始计时,windows每个时钟滴答将计数加一,每个时钟滴答的间隔是100 nanoseconds(纳秒,1秒=10的九次方纳秒 ...
- Unix时间戳 POSIX时间 Unix时间
Unix时间戳(Unix timestamp),或称Unix时间(Unix time).POSIX时间(POSIX time),是一种时间表示方式,定义为从格林威治时间1970年01月01日00时00 ...
- unix时间转换为datetime\datetime转换为unixtime
/// <summary> /// unix时间转换为datetime /// </summary> /// <param name="timeStamp&qu ...
- 如何将北京时间批量转为Unix时间?用Excel!
前面我们说过Unix时间戳转换怎样在Excel批量修改,有些人就想如果有特殊需求,那能不能批量将北京时间批量转成unix时间呢?能!用Excel就可以实现!跟ytkah一起试试吧. 将unix时间戳转 ...
- unix 时间
from_unixtime()是MySQL里的时间函数 mysql>SELECT FROM_UNIXTIME( 1249488000, '%Y%m%d' ) ->20071120 mysq ...
- MySQL与unix时间问题
1.select unix_timestamp() -->可以返回以秒记的unix时间. 2.select from_unixtime('1455804595','%Y年%m月%d号'); -- ...
随机推荐
- 微信小程序分享至朋友圈的方法
最近研究怎么实现微信小程序分享至朋友圈,对就是朋友圈. 微信小程序目前没有直接提供方法来将小程序分享至朋友圈,不过可以采用曲线救国的方式来达到目的. 方法分两步: 1.通过浏览器将希望分享的东西风向至 ...
- tornado实现不同app路由分发
tornado实现app路由分发 from tornado import ioloop from tornado.httpserver import HTTPServer from tornado.w ...
- docker win10 推送镜像问题
镜像制作 docker build -t gameniuniu:v1.1 . 一.推送 1.docker images 中查找IMAGE ID镜像 2.docker commit <IMAGE ...
- Linux学习,Vim以及Vi常用快捷键
VIM配置文件路径: /etc/vmrc ===> 系统配置文件路径 ~/.vimrc ===> 当前用户配置文件路径 $VIM ===> 与VIM配置文件相关的变量 进入插入模式: ...
- 37 net 网络编程
InetAddress:此类表示互联网协议 (IP) 地址. Stringbuilder getHostAddress() 返回 IP 地址. Stringbuilder getHostName() ...
- String 对象-->charCodeAt() 方法
1.定义和用法 获取指定下标的字符的ASCII码(Unicode) 返回值:0~65535之间的整数 语法: string.charCodeAt(index) 参数: index:指定字符的下标 举例 ...
- 配置spark历史服务(spark二)
1. 编辑spark-defaults.conf位置文件 添加spark.eventLog.enabled和spark.eventLog.dir的配置修改spark.eventLog.dir为我们之前 ...
- Hadoop(一) centos7 jdk安装,hadoop安装|3
安装JDK 下载jdk https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 选择最 ...
- networkx学习与攻击转移图可视化
接到一个任务,将攻击转移矩阵进行可视化,生成攻击转移概率图,便尝试用python实现一下. 查阅资料,看大家都在用networkx和matplotlib进行可视化,便边学边做,记录一下学习笔记. 任务 ...
- paste命令-合并文件
paste [-s] [-d " "] [file1] [file2] -s:将文件合并成行 -d:显示时的分割符 //1.txt 1 6 2 7 3 8 4 9 5 10 //2 ...