Conversion of date and time in c shell perl php: seconds and human readable date scalar localtime and seconds since '00: 00: 00 1970-01-01 UTC'
Scalar localtime 26-byte string and seconds since '00: 00: 00 1970-01-01 UTC'
(The number of seconds since, January 1, January 1, 1970)
The number of seconds that have passed since the Epoch: 00:00:00 January 1, 1970, Coordinated Universal Time (UTC ).
C:
Advanced Programming in the UNIX Environment: Second Edition
APUE Seciont 6.10 Figure 6.8. Relationship of the various time functions
# Include <time. h>
Time_t time (time_t * calptr );
Struct tm * localtime (const time_t * calptr );
Struct tm * gmtime (const time_t * calptr );
Time_t mktime (struct tm * tmptr );
Char * asctime (const struct tm * tmptr );
Char * ctime (const time_t * calptr );
Size_t strftime (char * restrict buf, size_t maxsize,
Const char * restrict format,
Const struct tm * restrict tmptr );
Shell:
% Date + % s
1128621784
% Date-d "1970-01-01 UTC 1128621784 seconds"
Fri Oct 7 02:03:04 CST 2005
Date-d "1970-01-01 UTC 1128621784 seconds" + "% Y-% m-% d % H: % M: % S"
2005-10-07 02:03:04
Perl:
% Perl-e 'print scalar localtime 1128621784'
Fri Oct 7 02:03:04 2005
Php:
Date ('Y-m-d H: I: s', time ());