Timestamp: Difference between revisions From Online Manual

Jump to: navigation, search
(Mention the SMF function; should be expanded)
No edit summary
 
Line 1: Line 1:
A timestamp is a way of representing times in programming languages. Usually, this is a unix timestamp, expressed as the number of seconds since midnight on December 31, 1969. As an example, the timestamp of January 1, 2006 at 12:00:00 am is 1136102400.
A timestamp is a way of representing times in programming languages. Usually, this is a unix timestamp, expressed as the number of seconds since midnight on December 31, 1969. As an example, the timestamp of January 1, 2006 at 12:00:00 am is 1136102400.
In MySQL, you can easily work with this by using the UNIX_TIMESTAMP() and FROM_UNIXTIME() functions, which translate between dates as strings and dates as timestamps. Examples include:
{{Code|1=
SELECT UNIX_TIMESTAMP('2006-01-01 0:00:00');
SELECT FROM_UNIXTIME(1136102400);
INSERT INTO smf_members
(memberName, realName, emailAddress, dateRegistered, passwd)
VALUES ('member', 'member', '[email protected]', UNIX_TIMESTAMP(NOW()),
MD5('password'));
}}
In SMF, there is a specialized function named timeformat($log_time, $show_today = true, $offset_type = false).
In general PHP, you can work with them by using the [http://php.net/manual/en/function.time.php time()], [http://php.net/manual/en/function.strftime.php strftime()], and [http://php.net/manual/en/function.strtotime.php strtotime()] functions.


<noinclude>
<noinclude>
[[Category:SMF terminology]]
[[Category:SMF terminology]]
</noinclude>
</noinclude>

Latest revision as of 20:21, 8 July 2013

A timestamp is a way of representing times in programming languages. Usually, this is a unix timestamp, expressed as the number of seconds since midnight on December 31, 1969. As an example, the timestamp of January 1, 2006 at 12:00:00 am is 1136102400.



Advertisement: