date():格式化一个本地时间或者日期,当前时间 2016年5月13日 15:19:49
使用函数date(),输出当前是月份中的第几天,参数:String类型 d
例如:echo date("d"); 输出 13
使用函数date(),输出当前是星期中的第几天,参数:String类型 D或者 N
例如:echo date("D"); 输出 Fri
echo date("N"); 输出 5
echo date("l"); 输出 Friday
使用函数date(),输出当前月份中的第几月,参数:String类型 n
echo date("n"); 输出 5
使用函数date(),判断当前年份是否是闰年,参数:String类型 L
echo date("L"); 输出 1
strtotime():把字符串类型日期格式转成时间戳
使用函数strtotime(),打印前一天日期,参数:String类型 “-1 day”
echo date("Y-m-d H:i:s",strtotime("-1day"));输出 2016-05-12 15:27:33
使用函数strtotime(),打印明天日期,参数:String类型 “+1 day”
echo date("Y-m-d H:i:s",strtotime("+1 day"));输出 2016-05-14 15:28:29
使用函数strtotime(),打印下周日期,参数:String类型 “+1 week”
echo date("Y-m-d H:i:s",strtotime("+1 week"));;输出 2016-05-20 15:29:35
使用函数strtotime(),打印下一个月日期,参数:String类型 “+1 month”
echo date("Y-m-d H:i:s",strtotime("+1 month")); 输出:2016-06-13 15:37:42
使用函数strtotime(),打印下周一日期,参数:String类型 “last Mondy”
echo date("Y-m-d H:i:s",strtotime("next Monday")); 输出:2016-05-16 00:00:00
使用函数strtotime(),打印下周零两天两小时两秒后日期,参数:String类型组合一下
echo date("Y-m-d H:i:s",strtotime("+1 week 2 day 2 hour")); 输出 2016-05-22 17:34:34
==================================================================
java版:
java.util.Date类
获取Date对象,new出来
调用Date对象的getTime()方法,获取时间戳(毫秒值)
java.text.SimpleDateFormat类
获取SimpleDateFormat对象,new出来,构造参数:"yyyy-MM-dd hh:mm:ss"
调用SimpleDateFormat对象的format()方法,获取String类型的日期,参数:Date对象
例如:
Date date=new Date();
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(format.format(date));

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Dreamweaver Mac version
Visual web development tools

Dreamweaver CS6
Visual web development tools

SublimeText3 Chinese version
Chinese version, very easy to use
