Tag Archives: strtotime
五四陈透过PHP看JAVA系列:strtotime
本系列主要总结PHP与JAVA之间的一些异同,给从PHP学JAVA或者是从JAVA学PHP的同学一点启发,五四陈科学院出品。 第一部分,先看PHP的Date/Tme函数 详细见:http://www.54chen.com/p/ref.datetime.html 今天要说的是其中的strtotime函数 http://www.54chen.com/p/function.strtotime.html 函数的功能:接受一个包含美国英语日期格式的字符串并尝试将其解析为 Unix 时间戳(自 January 1 1970 00:00:00 GMT 起的秒数)。 例子: <?php echo strtotime("2010-3-3 3:3:3"); ?> 将得到结果: 1267585383 在PHP应用中,经常在需要记录时间的时候,使用Mysql的int(10)来保存这个 Unix 时间戳,并且时间的比较查找等操作,都用大于小于来进行。 第二部分,看JAVA对应的方法 try { fromUnixTime = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse("01/03/2010 08:00:00").getTime(); fromUnixTime /= 1000; } catch (ParseException …
SEARCH
Update
- 人肉解析riak_admin join
- go语言安装手记
- 54chen Twitter memo 2012-02-05
- Riak Core说明
- maven库nexus拖不到jar包小记
- 服务接入层小结
- 54chen Twitter memo 2012-01-15
- nginx防hashdos模块使用帮助
- 54chen Twitter memo 2012-01-08
- nginx防hashdos模块释出
- 54chen Twitter memo 2012-01-01
- 水煮鱼杯2011年度不得不总结的十件事
- 年终攻击hashDos-哈希表多碰撞实现拒绝服务-破解办法
- 54chen Twitter memo 2011-12-25
- riak 1.0.2安装手记
