cshellperlphp下的日期时间转换:秒数与人类可读日期scalarlocaltime与secondssince00:00:001970-01-01UTC' <BR>scalarlocaltime26-bytestring与secondssince 00: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); structtmlocaltime(consttime_tcalptr); structtmgmtime(consttime_tcalptr); time_tmktime(structtmtmptr); charasctime(conststructtmtmptr); charctime(consttime_tcalptr); size_tstrftime(charrestrictbuf,size_tmaxsize, constcharrestrictformat, 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()); (编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|