checkdate 验证日期的正确性。
语法: int checkdate(int month, int day, int year);
返回值: 整数
函数种类: 时间日期
内容说明 若日期是有效的则返回 true,若日期有问题,则返回 false。本函数可以用来检查日期是否有效。有效范围如下:
年 为 0 至 32767 年
月 为 1 至 12 月
日 则随着月份及闰年变化
月 为 1 至 12 月
日 则随着月份及闰年变化
date 将服务器的时间格式化。
语法: string date(string format, int [timestamp]);
返回值: 字符串
函数种类: 时间日期
内容说明返回值的?字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间格式化返回。要将日期转为其它的语系格式,应使用setlocale() 及 strftime() 二个函数。字符串格式化的选项如下:
语法: string date(string format, int [timestamp]);
返回值: 字符串
函数种类: 时间日期
内容说明返回值的?字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间格式化返回。要将日期转为其它的语系格式,应使用setlocale() 及 strftime() 二个函数。字符串格式化的选项如下:
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"
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"
其它不在上列的字符则直接列出该字符。
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"
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"
其它不在上列的字符则直接列出该字符。
使用范例,范例一:
<?
print(date( "l dS of F Y h:i:s A" ));
print("July 1, 2000 is on a " . date("l", mktime(0,0,0,7,1,2000)));
?>
<?
print(date( "l dS of F Y h:i:s A" ));
print("July 1, 2000 is on a " . date("l", mktime(0,0,0,7,1,2000)));
?>
范例二:
<?
$tomorrow = mktime(0,0,0,date("m") ,date("d")+1,date("Y"));
$lastmonth = mktime(0,0,0,date("m")-1,date("d"), date("Y"));
$nextyear = mktime(0,0,0,date("m"), date("d", date("Y")+1);
?>
参考 gmdate() mktime()
strftime 将服务器的时间本地格式化。
语法: string strftime(string format, int [timestamp]);
返回值: 字符串
函数种类: 时间日期
内容说明 返回值的字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间本地格式化返回。月份或者星期名称随着本地语系配置 setlocale() 的不同而改变。
语法: string strftime(string format, int [timestamp]);
返回值: 字符串
函数种类: 时间日期
内容说明 返回值的字符串依配置的格式来决定。若有传入时间戳记值,则将时间戳记格式化返回;若无传入时间戳记值,则将目前服务器的时间本地格式化返回。月份或者星期名称随着本地语系配置 setlocale() 的不同而改变。
返回的字符串可以依下列的格式而定:
%a 星期几的缩写。
%A 星期几的全名。
%b 月份名称的缩写。
%B 月份名称的全名。
%c 本地端日期时间较佳表示字符串。
%d 用数字表示本月的第几天 (范围为 00 至 31)。
%H 用 24 小时制数字表示小时数 (范围为 00 至 23)。
%I 用 12 小时制数字表示小时数 (范围为 01 至 12)。
%j 以数字表示当年度的第几天 (范围为 001 至 366)。
%m 月份的数字 (范围由 1 至 12)。
%M 分钟。
%p 以 ‘AM’ 或 ‘PM’ 表示本地端时间。
%S 秒数。
%U 数字表示为本年度的第几周,第一个星期由第一个周日开始。
%W 数字表示为本年度的第几周,第一个星期由第一个周一开始。
%w 用数字表示本周的第几天 ( 0 为周日)。
%x 不含时间的日期表示法。
%X 不含日期的时间表示法。
%y 二位数字表示年份 (范围由 00 至 99)。
%Y 完整的年份数字表示,即四位数。
%Z 时区或名称缩写。
%% % 字符。
%a 星期几的缩写。
%A 星期几的全名。
%b 月份名称的缩写。
%B 月份名称的全名。
%c 本地端日期时间较佳表示字符串。
%d 用数字表示本月的第几天 (范围为 00 至 31)。
%H 用 24 小时制数字表示小时数 (范围为 00 至 23)。
%I 用 12 小时制数字表示小时数 (范围为 01 至 12)。
%j 以数字表示当年度的第几天 (范围为 001 至 366)。
%m 月份的数字 (范围由 1 至 12)。
%M 分钟。
%p 以 ‘AM’ 或 ‘PM’ 表示本地端时间。
%S 秒数。
%U 数字表示为本年度的第几周,第一个星期由第一个周日开始。
%W 数字表示为本年度的第几周,第一个星期由第一个周一开始。
%w 用数字表示本周的第几天 ( 0 为周日)。
%x 不含时间的日期表示法。
%X 不含日期的时间表示法。
%y 二位数字表示年份 (范围由 00 至 99)。
%Y 完整的年份数字表示,即四位数。
%Z 时区或名称缩写。
%% % 字符。
使用范例
<?php
setlocale ("LC_TIME", "C");
print(strftime("%A in Finnish is "));
setlocale ("LC_TIME", "fi");
print(strftime("%A, in French "));
setlocale ("LC_TIME", "fr");
print(strftime("%A and in German "));
setlocale ("LC_TIME", "de");
print(strftime("%A.n"));
?>
参考 setlocale() mktime()
<?php
setlocale ("LC_TIME", "C");
print(strftime("%A in Finnish is "));
setlocale ("LC_TIME", "fi");
print(strftime("%A, in French "));
setlocale ("LC_TIME", "fr");
print(strftime("%A and in German "));
setlocale ("LC_TIME", "de");
print(strftime("%A.n"));
?>
参考 setlocale() mktime()
getdate 获得时间及日期信息。
语法: array getdate(int timestamp);
返回值: 数组
函数种类: 时间日期
内容说明 返回数组的元素包括下列的项目:
"seconds" – 秒
"minutes" – 分
"hours" – 时
"mday" – 当月的第几天
"wday" – 当周的第几天数字
"mon" – 月份数字
"year" – 年,数字
"yday" – 当年的第几天数字; 如: "299"
"weekday" – 星期几全名; 如: "Friday"
"month" – 月份全名; 如: "January"
语法: array getdate(int timestamp);
返回值: 数组
函数种类: 时间日期
内容说明 返回数组的元素包括下列的项目:
"seconds" – 秒
"minutes" – 分
"hours" – 时
"mday" – 当月的第几天
"wday" – 当周的第几天数字
"mon" – 月份数字
"year" – 年,数字
"yday" – 当年的第几天数字; 如: "299"
"weekday" – 星期几全名; 如: "Friday"
"month" – 月份全名; 如: "January"
gettimeofday 取得目前时间。
语法: array gettimeofday(void);
返回值: 数组
函数种类: 时间日期
内容说明 返回数组的元素包括下列的项目:
语法: array gettimeofday(void);
返回值: 数组
函数种类: 时间日期
内容说明 返回数组的元素包括下列的项目:
"sec" – 秒
"usec" – 百万分之一秒
"minuteswest" – 格林威治时间的分
"dsttime" – 目的的时区
"usec" – 百万分之一秒
"minuteswest" – 格林威治时间的分
"dsttime" – 目的的时区
gmdate 取得目前与 GMT 差后的时间。
语法: string gmdate(string format, int timestamp);
返回值: 字符串
函数种类: 时间日期
内容说明 本函数与 date() 函数相似,不同的是本函数返回与格林威治标准时间 (Greenwich Mean Time, GMT) 时间差后的时间
语法: string gmdate(string format, int timestamp);
返回值: 字符串
函数种类: 时间日期
内容说明 本函数与 date() 函数相似,不同的是本函数返回与格林威治标准时间 (Greenwich Mean Time, GMT) 时间差后的时间
使用范例
<?php
echo date( "M d Y H:i:s",mktime(0,0,0,1,1,1998) );
echo gmdate( "M d Y H:i:s",mktime(0,0,0,1,1,1998) );
?>
若执行本范例的机器在芬兰 (Finland, GMT +0200),返回的结果为:
<?php
echo date( "M d Y H:i:s",mktime(0,0,0,1,1,1998) );
echo gmdate( "M d Y H:i:s",mktime(0,0,0,1,1,1998) );
?>
若执行本范例的机器在芬兰 (Finland, GMT +0200),返回的结果为:
Jan 01 1998 00:00:00
Dec 31 1997 22:00:00
参考 date() mktime() gmmktime()
Dec 31 1997 22:00:00
参考 date() mktime() gmmktime()
easter_date 计算复活节日期。
语法: int easter_date(int [year]);
返回值: 整数
函数种类: 时间日期
内容说明: 输入某一年份,则以 UNIX 时间戳记的格式返回该年的复活节日期,若没有输入年份,则计算当年的日期。值的?注意的是输入的年份必需在公元 1970 至 2037 年之间,否则无法计算。
语法: int easter_date(int [year]);
返回值: 整数
函数种类: 时间日期
内容说明: 输入某一年份,则以 UNIX 时间戳记的格式返回该年的复活节日期,若没有输入年份,则计算当年的日期。值的?注意的是输入的年份必需在公元 1970 至 2037 年之间,否则无法计算。
使用范例
<?
echo date("M-d-Y", easter_date(1999));
echo date("M-d-Y", easter_date(2000));
echo date("M-d-Y", easter_date(2001));
?>
返回结果为
Apr-04-1999
Apr-23-2000
Apr-15-2001
<?
echo date("M-d-Y", easter_date(1999));
echo date("M-d-Y", easter_date(2000));
echo date("M-d-Y", easter_date(2001));
?>
返回结果为
Apr-04-1999
Apr-23-2000
Apr-15-2001
easter_days 计算复活节与三月廿一日之间日期数。
语法: int easter_days(int [year]);
返回值: 整数
函数种类: 时间日期
内容说明 输入某一年份,则以计算该年复活节与三月二十一日之间的日期数,若没有输入年份,则以当年计算。这个函数可以用来替代 easter_date() 1970-2037 年外范围无法计算的问题。
语法: int easter_days(int [year]);
返回值: 整数
函数种类: 时间日期
内容说明 输入某一年份,则以计算该年复活节与三月二十一日之间的日期数,若没有输入年份,则以当年计算。这个函数可以用来替代 easter_date() 1970-2037 年外范围无法计算的问题。
使用范例
<?
echo easter_days(1999);
echo easter_days(1492);
echo easter_days(1913);
?>
返回结果为:
14 (4/4)
32 (4/22)
2 (3/23)
参考 easter_date()
<?
echo easter_days(1999);
echo easter_days(1492);
echo easter_days(1913);
?>
返回结果为:
14 (4/4)
32 (4/22)
2 (3/23)
参考 easter_date()
mktime 取得 UNIX 时间戳记。
语法: int mktime(int hour, int minute, int second, int month, int day, int year);
返回值: 整数
函数种类: 时间日期
内容说明: 输入一个时间,则返回 UNIX 时间戳记的长整数。
语法: int mktime(int hour, int minute, int second, int month, int day, int year);
返回值: 整数
函数种类: 时间日期
内容说明: 输入一个时间,则返回 UNIX 时间戳记的长整数。
使用范例
<?
echo date( "M-d-Y", mktime(0,0,0,12,32,1997) );
echo date( "M-d-Y", mktime(0,0,0,13,1,1997) );
echo date( "M-d-Y", mktime(0,0,0,1,1,1998) );
?>
参考 date() time()
<?
echo date( "M-d-Y", mktime(0,0,0,12,32,1997) );
echo date( "M-d-Y", mktime(0,0,0,13,1,1997) );
echo date( "M-d-Y", mktime(0,0,0,1,1,1998) );
?>
参考 date() time()
gmmktime 取得 UNIX 时间戳记的格林威治时间。
语法: int gmmktime(int hour, int minute, int second, int month, int day, int year);
返回值: 整数
函数种类: 时间日期
内容说明: 输入一个时间,则返回 UNIX 的格林威治时间戳记的长整数。
语法: int gmmktime(int hour, int minute, int second, int month, int day, int year);
返回值: 整数
函数种类: 时间日期
内容说明: 输入一个时间,则返回 UNIX 的格林威治时间戳记的长整数。
time 取得目前时间的 UNIX 时间戳记。
语法: int time(void);
返回值: 整数
函数种类: 时间日期
内容说明 返回目前时间的戳记值。
参考 date()
语法: int time(void);
返回值: 整数
函数种类: 时间日期
内容说明 返回目前时间的戳记值。
参考 date()
microtime 取得目前时间的 UNIX 时间戳记的百万分之一秒值。
语法: string microtime(void);
返回值: 字符串
函数种类: 时间日期
内容说明 返回目前时间的百万分之一秒戳记值。若操作系统没有提供 gettimeofday() 的系统呼叫函数,则本函数亦无效。
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » PHP -time(),date(),mktime()日期与时间函数库
波比源码 » PHP -time(),date(),mktime()日期与时间函数库
buy levofloxacin order levofloxacin 250mg generic
buy accutane 10mg online cheap cost accutane 20mg zithromax 500mg pills
order arimidex 1mg online cheap bay viagra in ireland map order generic sildenafil
order ramipril online cheap irbesartan 150mg oral azelastine 10ml price
order terazosin 5mg online buy terazosin 1mg generic sulfasalazine 500 mg sale
alendronate 35mg sale order panadol 500mg sale cheap famotidine
imdur 40mg usa generic lanoxin 250 mg micardis pills
molnunat cheap order naproxen 250mg pill order prevacid 30mg sale
cheap tadalafil pill order generic cialis 20mg usa viagra overnight
order revia 50 mg online cost femara 2.5mg abilify online buy
order furosemide 100mg for sale order doxycycline 100mg generic purchase plaquenil for sale
vardenafil over the counter vardenafil 20mg over the counter medrol 16 mg pills
cheap aristocort loratadine pill oral desloratadine 5mg
buy zyloprim pill ezetimibe 10mg generic zetia 10mg cheap
ranitidine sale order mobic 15mg generic order celecoxib 100mg without prescription
diflucan price order sildenafil 100mg pills order viagra online
cheap viagra pills viagra medication cialis 20mg without prescription
order prednisone pills amoxil 250mg brand order amoxicillin 250mg online cheap
order fildena 100mg for sale buy nolvadex 10mg oral rhinocort
buy naprosyn online cefdinir 300mg sale lansoprazole 15mg tablet
purchase clarithromycin for sale antivert price buy meclizine pills
spiriva online hytrin 1mg generic hytrin 5mg canada
buy actos 15mg pill buy pioglitazone 30mg sale cost sildenafil 50mg
live dealer blackjack real poker online gambling games
ivermectin 2 buy avlosulfon oral dapsone
order adalat 10mg generic purchase fexofenadine allegra pills
cost ramipril 10mg order amaryl pill arcoxia sale
help me write a thesis brand azulfidine 500mg azulfidine uk
order mesalamine 800mg for sale order generic irbesartan 300mg irbesartan 150mg brand
buy olmesartan 20mg without prescription calan without prescription divalproex order
clobetasol tablet buspar without prescription order cordarone 100mg without prescription
buy amoxicillin pills stromectol 6mg sale generic ivermectin online
dapoxetine 60mg ca cheap domperidone motilium 10mg brand
purchase indocin capsule tamsulosin 0.4mg ca cenforce tablet
minocycline order online generic terazosin 5mg purchase terazosin pills
buy tadalafil 10mg online cheap Overnight cialis best ed pills
order glycomet 1000mg online order calan 120mg generic nolvadex 10mg sale
provigil pill phenergan online purchase promethazine online cheap
buy serophene without prescription order prednisolone 20mg for sale order prednisolone 40mg
order prednisone 20mg online isotretinoin uk amoxil 500mg sale
buy accutane 10mg online cheap order deltasone generic ampicillin 500mg
buy sildenafil pills order propecia 5mg generic finasteride 5mg price
stromectol 3mg ed remedies purchase prednisone for sale
buy absorica online cheap buy amoxil generic azithromycin over the counter
ventolin 4mg uk buy synthroid 150mcg pill clavulanate sale
prednisolone 10mg over the counter prednisolone 40mg pill order lasix online cheap
oral ditropan 2.5mg oxybutynin for sale online trileptal 300mg usa
zocor 10mg for sale buy sildalis generic sildenafil 100mg pills for sale
avlosulfon tablet buy asacol 800mg generic atenolol 100mg ca
cheap alfuzosin 10 mg uroxatral 10mg oral cost diltiazem 180mg
cost zetia order tetracycline for sale methotrexate 5mg drug
order zyrtec 10mg online cheap order cetirizine 10mg without prescription zoloft pill
cenforce 50mg brand aralen pills metformin ca
atorvastatin 40mg sale 50mg viagra sildenafil medication
buy femara generic sildenafil 50mg without prescription sildenafil online buy
order tadalafil 10mg without prescription cialis super active top ed drugs
ivermectin 6 mg online order isotretinoin 40mg generic buy accutane 10mg online
order modafinil 100mg pills buy cheap promethazine prednisone 20mg pills
albuterol cheap where to buy clavulanate without a prescription levothyroxine online buy
buy prednisolone 40mg online cheap buy prednisolone 20mg online cheap order furosemide 40mg online
doxycycline price augmentin 375mg uk purchase amoxiclav
buy synthroid sale buy clomiphene 100mg without prescription generic levitra 20mg
albendazole 400 mg sale medroxyprogesterone 10mg oral buy medroxyprogesterone generic
buy biltricide medication periactin order online periactin 4mg generic
cost zestril omeprazole uk lopressor 100mg brand
purchase rosuvastatin for sale buy cheap generic domperidone domperidone 10mg for sale
order generic sumatriptan 25mg order sumatriptan sale buy cheap dutasteride
buy clopidogrel 150mg online order ketoconazole 200 mg sale buy nizoral 200mg without prescription
bystolic order buy bystolic 5mg generic clozapine price
brand zocor 20mg buy cheap simvastatin viagra oral
oral tegretol 400mg order tegretol 200mg without prescription lincocin pills
tadalafil tablets order cialis 10mg pill order sildenafil online cheap
order duricef 250mg order lamivudine pill purchase proscar
buy estrace 1mg pills buy lamictal 200mg sale buy minipress 1mg generic
buy fluconazole 200mg without prescription diflucan 200mg sale cipro 500mg without prescription
order vermox for sale buy generic tretinoin gel buy tadalis 10mg sale
metronidazole 200mg uk septra generic keflex pill
order avana 100mg for sale avana drug buy voltaren pills
order indocin 50mg for sale cefixime over the counter buy cefixime 200mg generic
buy nolvadex medication purchase budesonide buy cefuroxime 500mg generic
buy clonidine online order antivert pills buy spiriva cheap
arava 10mg canada order viagra online cheap buy azulfidine pills
order isotretinoin online cheap amoxicillin 1000mg brand order azithromycin without prescription
purchase azithromycin for sale buy prednisolone 10mg without prescription cheap neurontin 100mg
ivermectin 50ml order prednisone generic deltasone without prescription
furosemide uk doxycycline online order albuterol cheap
buy levitra generic zanaflex drug order plaquenil 400mg online cheap
purchase vardenafil for sale tizanidine usa hydroxychloroquine buy online
buy clobetasol without prescription purchase buspirone online amiodarone 100mg sale
acetazolamide for sale diamox cost order azathioprine 50mg online cheap
naproxen for sale buy lansoprazole for sale order lansoprazole 30mg generic