cshellperlphp下的日期时间转换:秒数与人类可读日期scalarlocaltime与secondssince00:00:001970-01-01UTC' <BR>scalarlocaltime26-bytestring与secondssince00:00:001970-01-01UTC'
(1970年1月1日凌晨零点以来的秒数)
thenumberofsecondsthathavepassedsincetheEpoch:00:00:00January1,1970,CoordinatedUniversalTime(UTC). c:
《AdvancedProgrammingintheUNIXEnvironment:SecondEdition》
简称《APUE》Seciont6.10Figure6.8.Relationshipofthevarioustimefunctions说的清楚
#include<time.h>
time_ttime(time_tcalptr);
structtm
localtime(consttime_tcalptr);
structtm
gmtime(consttime_tcalptr);
time_tmktime(structtm
tmptr);
charasctime(conststructtmtmptr);
charctime(consttime_tcalptr);
size_tstrftime(charrestrictbuf,size_tmaxsize,
constchar
restrictformat,
conststructtm*restricttmptr); shell:
%date+%s
1128621784 %date-d"1970-01-01UTC1128621784seconds"
FriOct702:03:04CST2005 date-d"1970-01-01UTC1128621784seconds"+"%Y-%m-%d%H:%M:%S"
2005-10-0702:03:04 perl:
%perl-e'printscalarlocaltime1128621784'
FriOct702:03:042005 php:
date('Y-m-dH:i:s',time());

dawei

【声明】:丽水站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。