php -- 日期时间
----- 017-datetime.php -----
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>日期与时间</title>
</head>
<body>
<h3>日期与时间</h3>
<pre>
<?php
$start_time = substr(microtime(), 0, 10);
echo "2014年2月28存在否?", checkdate(2, 28, 2014), "\n";
echo "2014年2月29存在否?", checkdate(2, 29, 2014), "\n";
echo "以数组形式返回当前时间:\n";
print_r(@getdate());//getdate()[0] == time()36*8
echo "现在是:", @date("Y-m-d H:i:s", @getdate()[0]+28800), "\n";
echo "现在的格林威治时间是:", gmdate("Y-m-d H:i:s", @getdate()[0]), "\n";
echo "当前UTC-UNIX时间戳:", time(), "\n";
echo "今天:", @strtotime("TOday"), "\n";
echo "明天:", @strtotime("tomorrow"), "\n";
echo "后天:", @strtotime("tomorrow + 1days"), "\n";
echo "当前UNIX时间戳和微秒数:";
print_r(microtime(false));echo "\n";
echo "当前时间戳浮点数:", microtime(true), "\n";
date_default_timezone_set("PRC");//设置时区为东八区
echo "东八区时间: ", date("Y-m-d H-i-s", time()), "\n";
$end_time = substr(microtime(), 0, 10);
echo "程序开始时间:", $start_time, " ";
echo "程序结束时间:", $end_time, " \n";
printf("程序运行了%f微秒\n", $end_time-$start_time);
?>
</pre>
</body>
</html>

php -- 日期时间的更多相关文章
- EasyUI datagrid 日期时间格式化
EasyUI datagrid中显示日期时间时,会显示为以下不太直观的数值: 添加以下JavaScript脚本,然后在field中添加 formatter: DateTimeFormatter 即可. ...
- POCO库——Foundation组件之日期时间DateTime
日期时间DateTime:内部提供多个设计计时器.日期.时区.时间戳等: Clock.h :Clock时钟计时类,_clock:Int64类型时钟值,CLOCKVAL_MIN.CLOCKVAL_MAX ...
- db2 日期时间格式
db2日期和时间常用汇总 1.db2可以通过SYSIBM.SYSDUMMY1.SYSIBM.DUAL获取寄存器中的值,也可以通过VALUES关键字获取寄存器中的值. SELECT 'HELLO DB2 ...
- Angularjs在控制器(controller.js)的js代码中使用过滤器($filter)格式化日期/时间实例
Angularjs内置的过滤器(filter)为我们的数据信息格式化提供了比较强大的功能,比如:格式化时间,日期.格式化数字精度.语言本地化.格式化货币等等.但这些过滤器一般都是在VIEW中使用的,比 ...
- MySQL学习笔记八:日期/时间的处理
MySQL日期时间的处理,在其官网文档上都有详细的阐述,想了解更多的同学可自行查阅. 1.查询当前日期时间:函数有now(),localtime(),current_timestamp(),sysda ...
- Java日期时间操作的一些方法
1. 获得Calendar实例: Calendar c = Calendar.getInstance(); 2. 定义日期/时间的格式: SimpleDateFormat sdf =new Simpl ...
- mysql与oracle的日期/时间函数小结
前言 本文的日期/时间全部格式化为”2016-01-01 01:01:01“形式: MONITOR_TIME为数据库表字段: 字符串与日期/时间相互转换函数 Oracle 日期/时间转字符串函数:to ...
- js 日期时间排序 数组
不多说直接show代码 var timeArr=[ {'id':'A01','date':'2016-04-20 23:22:11'}, {'id':'A02','date':'2016-04-21 ...
- sql server日期时间转字符串
一.sql server日期时间函数Sql Server中的日期与时间函数 1. 当前系统日期.时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基 ...
- 移动端lCalendar纯原生js日期时间选择器
网上找过很多的移动端基于zepto或jquery的日期选择器,在实际产品中也用过一两种,觉得都不太尽如人意,后来果断选择了H5自己的日期input表单,觉得还可以,至少不用引用第三方插件了,性能也不错 ...
随机推荐
- 转载:$(function() {}),即$(document).ready(function(),什么时候执行?以此为准,真理
转载:https://blog.csdn.net/Ideality_hunter/article/details/77935656 $(function() { //执行操作 }); $(functi ...
- Linux vi 文本代码时显示行号或不显示行号
Linux vi 文本代码时显示行号或不显示行号 前提 安装了vim $vi ~/.vimrc 显示的话加上 set nu 不想显示的话可以注释掉 "set nu 之后 $source ~ ...
- Legal or Not HDU
Legal or Not Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- nfs 客户端挂住
mount -t nfs -o soft,retry=1,timeo=10,intr 192.168.9.27:/mnt/vm /mnt/nfs-vm 可以让NFS client在连接不到NFS se ...
- 元组(tuple)基本操作
1.定义元组,Python的元组和列表类似,不同之处在于元组中的元素不能修改(因此元组又称为只读列表),且元组使用小括号而列表使用中括号 dimensions.py , ) print(dimensi ...
- 安卓读写INI文件 安卓读写INI文件
安卓读写INI文件 安卓读写INI文件 uses System.IoUtils procedure TForm1.Button1Click(Sender: TObject);varIniFile: ...
- Android-Java-单例模式优化&多线程并发
上一篇博客,Android-Java单例模式,介绍了在真实开发过程中,普遍使用的几种单例模式,而今天这篇博客,将要对单利模式进行优化 并且 通过多线程并发来分析 单利模式的优化: 对于为什么会出现安全 ...
- hdu 1.2.6
勾股定理... #include<cstdio> #include<algorithm> using namespace std; int main() { //freopen ...
- MySql and Oracle Data Type Mappings
the default settings used by SQL Developer to convert data types from MySQL to Oracle. SQL Developer ...
- JS学习笔记2_面向对象
1.对象的定义 ECMAScript中,对象是一个无序属性集,这里的“属性”可以是基本值.对象或者函数 2.数据属性与访问器属性 数据属性即有值的属性,可以设置属性只读.不可删除.不可枚举等等 访问器 ...