/**************格式中可使用字母的含义**************/
a – "am" 或是 "pm" 
A – "AM" 或是 "PM" 
d – 几日,二位数字,若不足二位则前面补零; 如: "01" 至 "31" 
D – 星期几,三个英文字母; 如: "Fri" 
F – 月份,英文全名; 如: "January" 
h – 12 小时制的小时; 如: "01" 至 "12" 
H – 24 小时制的小时; 如: "00" 至 "23"       
g – 12 小时制的小时,不足二位不补零; 如: "1" 至 12" 
G – 24 小时制的小时,不足二位不补零; 如: "0" 至 "23"         
i – 分钟; 如: "00" 至 "59" 
j – 几日,二位数字,若不足二位不补零; 如: "1" 至 "31" 
l – 星期几,英文全名; 如: "Friday"
L- get 闰年 return 1 else return 0 
m – 月份,二位数字,若不足二位则在前面补零; 如: "01" 至 "12" 
n – 月份,二位数字,若不足二位则不补零; 如: "1" 至 "12" 
M – 月份,三个英文字母; 如: "Jan" 
s – 秒; 如: "00" 至 "59" 
S – 字尾加英文序数,二个英文字母; 如: "th","nd" 
t – 指定月份的天数; 如: "28" 至 "31" 
U – 总秒数 
w – 数字型的星期几,如: "0" (星期日) 至 "6" (星期六) 
Y – 年,四位数字; 如: "1999" 
y – 年,二位数字; 如: "99" 
z – 一年中的第几天; 如: "0" 至 "365" 
 
1.date(char_date,unix);
current date: 2015-4-7 10:10 AM
echo date('Y-m-d  H:i  A');                 --->output: 2015-4-7 02:10   AM
echo date('Y-m-d  h:i  A');              --->output: 2015-4-7 02:10   AM   Not Chang  
(1)date_default_timezone_set('PRC');   PHP 5.1+
(2)PHP.ini  Update  date.tiemzone=PRC 
echo date('Y-m-d  h:i  A');              --->output: 2015-4-7 10:10   AM  Changed
2.strtotime(char_date[,int $now]);     The date string conversion unix 
echo strtotime('2015-4-7');            --->output:1428336000  timestamp
echo date('Y-m-d',strtotime('2015-4-7');      --->output:2015-04-06
echo date('Y-m-d',strtotime("+3 day");       --->output:2015-04-10
echo date('Y-m-d',strtotime("next year");     --->output:2016-04-10
3.gmdate(char_date_mode,unix);    The unix conversion date string          
echo gmdate("Y-m-d",1428336000);            --->output:2015-04-06
4.mktime(h,i,s,m="m",d="d",y="y");          based on date  return unix
echo gmdate("Y-m-d H:i:s A",mktime(0,0,0,"8","18","2018"));  --->output: 2018-08-17 16:00:00 PM
5.checkdate(m,d,y);      checking data time
echo checkdate(13,10,2016) ? "True":"False";     --->output:  False
echo checkdate(12,10,2016) ? "True":"False";     --->output:  True
6.getdate(unix)        return  date  array 
print_r(getdate(time());
Array (
[seconds] => 37 [minutes] => 10 [hours] => 16 [mday] => 7 [wday] => 2 [mon] => 4
[year] => 2015 [yday] => 96 [weekday] => Tuesday [month] => April [0] => 1428394237
)
 
 

PHP Date Function Base的更多相关文章

  1. PHP Warning: date() [function.date]: It is not safe to rely on the system's timezone

    在用PHP5.3以上的PHP版本时,只要是涉及时间的会报一个 Warning: phpinfo() [function.phpinfo]: It is not safe to rely on the ...

  2. Oracle Date Function 讲解和事例

    1 year=1*12 months 1 day=24 hours=24*(1*60mins)=24*60*(1*60 seconds) 1 week =7 days 注意: 黑色字体是 oracle ...

  3. Trigonometric Function - Base

    虽然三角函数是初中知识,比较简单,却也因为是初中知识,距现在比较久,难免忘掉一些,所以复习一下. 三角函数英文单词 正弦:sine 余弦:cosine 正切:tangent 余切:contangent ...

  4. jqeury.base

    min.js //前台调用 var $ = function (args) { return new Base(args); } //基础库 function Base(args) { //创建一个数 ...

  5. [笔记]记录原开发工作在base命名空间下扩展的属性与方法

    前言 该笔记只是为了记录以前开发使用的方式. 处理命名空间namespace /** * 处理命名空间 * @param {string} 空间名称,可多个 * @return {object} 对象 ...

  6. abap 常用 function

    ABAP常用函数总结  alv .smartform. excel .text.邮件 .远程访问,FTP服务器...  **********常用功能function REUSE_ALV_GRID_DI ...

  7. [Node.js] 05 - Modules and Function

    一个 Node.js 文件就是一个模块,这个文件可能是JavaScript 代码.JSON 或者编译过的C/C++ 扩展. 模块是Node.js 应用程序的基本组成部分,文件和模块是一一对应的. No ...

  8. PHP出现报警后需要修改 date.timezone 的值(php.ini)

    PHP调试的时候出现了警告: It is not safe to rely on the system解决方法,其实就是时区设置不正确造成的,本文提供了3种方法来解决这个问题. 实际上,从PHP 5. ...

  9. php date("Y-m-d H:i:s") 出现警告信息

    使用: $createtime=date("Y/m/d H:i:s", time()+16*60*60); $createtime=date("Y-m-d H:i:s&q ...

随机推荐

  1. InfoObject共享

    声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...

  2. 各版本Office办公软件下载

    各版本Office办公软件下载:http://pan.baidu.com/share/home?uk=1174874628

  3. PHP-----数组和常见排序算法

    数组的创建 <?php //php创建数组 //第一种方法 $arr[0]=1; $arr[1]=23; $arr[2]=20; $arr[3]=43; for($i=0;$i<count ...

  4. C#中的多线程 - 基础知识

    原文:http://www.albahari.com/threading/ 文章来源:http://blog.gkarch.com/threading/part1.html 1简介及概念 C# 支持通 ...

  5. LTE Module User Documentation(翻译10)——网络连接(Network Attachment)

    LTE用户文档 (如有不当的地方,欢迎指正!) 16 Network Attachment(网络连接)   正如前面章节 Basic simulation program 所述,连接用户到基站时通过调 ...

  6. OSG开发概览

    1 OSG基础知识 Ø OSG是Open Scene Graphic 的缩写,OSG于1997年诞生于以为滑翔机爱好者之手,Don burns  为了对滑翔机的飞行进行模拟,对openGL的库进行了封 ...

  7. Sealed密封类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; #region 概述 //在 ...

  8. hasOwnProperty,in

    hasOwnProperty,in区别: hasOwnProperty:指出一个对象是否具有指定名称的属性 in:对象是否能够访问此属性(包括直接在对象上访问和通过原型访问) 看下示例代码: (fun ...

  9. ssh和putty

    SH(Secure Shell的缩写),由 IETF 的网络工作小组(Network Working Group)所制定:SSH 为建立在应用层和传输层基础上的安全协议.SSH 是目前较可靠,专为远程 ...

  10. 解决Selenium与firefox浏览器版本不兼容问题

    因为在用java打开firefox浏览器的时候报错 org.openqa.selenium.firefox.NotConnectedException: Unable to connect to ho ...