php强大的时间转换函数strtotime
来源:才华咖 本文已影响2.45W人
来源:才华咖 本文已影响2.45W人
在php中strtotime() 函数将任何英文文本的日期时间描述解析为 Unix 时间戳,这个函数也是我们经常会用到的`,有需要的朋友参考一下.
使用strtotime可以将各种格式的时间字符串转换为时间戳
转换常规时间格式
?
1
2
3
echo date('Y-m-d H:i:s', strtotime('2016-01-30 18:00'))_EOL;
echo date('Y-m-d H:i:s', strtotime('20160130180001'))_EOL;
转换自然时间描述
//昨天
echo date('Y-m-d H:i:s', strtotime('yesterday'))_EOL;
//上周
echo date('Y-m-d H:i:s', strtotime('last week'))_EOL;
//本周开始时间
echo date('Y-m-d H:i:s', strtotime('this week midnight'))_EOL;
//本月开始时间
echo date('Y-m-d H:i:s', strtotime('first day of this month midnight'))_EOL;
//计算相对时间
echo date('Y-m-d H:i:s', strtotime('+1 month'))_EOL;
英语高分作文:The importance of protecting the environment
The most important festival英语作文
PEP英语UnitThreeisthisyourskirt的教学设计
Adobe Photoshop Lightroom快速修图十大技巧
The relationship between theory and practice大学英语作文
The Person I Admire the Most大学英语作文
The Enthusiasm For Sports 高中英语作文
新概念英语青少版2a课文Unit 04:The top three persent
Why Respect Is Important英语作文
关于JavaScript中isPrototypeOf函数作用和使用实例
英语四级听力训练: this is the Technology Report
英语作文:The Merits of Computer Games
A Letter to the University President为题目的作文
The First Time to Make Dumplings英语作文及译文
The composition of the tree英语作文
The truth about money and happiness高中英语作文
中考英语阅读理解答案A report from the United Nations
六下英语Unit5Ourearthlookslikethisfromspace教案
At Climate Summit, Hope for Emissions Deal美文欣赏
php内核分析之sapi-module-struct
How to protect the environment初中英语作文
The Sports Meeting 英语作文
php函数method-exists()与is-callable()有何区别
少儿英语小故事:She Practices Flips for the Olympic
Stop Polluting the Water高中英语作文
初中英语作文To Bea Computer Expert Is My Ideal
商场营业时间告知函
php错误提示failed to open stream
The Impact of Information Explosion高中英语作文
Protecting the Forests为题目的作文
php时间戳的转换函数
Ought Parents to Give Children Pocket英语作文
Jolie drops battle over perfume named Shilohy英语作文
用时间换金钱
《the most interesting stories》湘少版六下Unit7的相关知识及
Lets Repair It Together!初中英语作文
Hot spring Let Me Have A Rest为题目的作文
英语四级作文The Importance of Physical Exercise
解决PHP中file-get-contents函数的方法
指数函数与对数函数的转换