Jump to content

Archived

This topic is now archived and is closed to further replies.

gladiator83x

Timestamp Issue

Recommended Posts

Hey All,

I had inserted timestamps in several of my MYSQL tables. One time stamp represents the time that something was created, the other represents the time that that same something was finished and submitted. I was trying to figure out if there was some sort of math function that will take the difference of these two timestamps? The piece of code below shows how I am obtaining my timestamps; I then just echo the variable I equate the date function to.

$test_date = date("Y-m-d H:i:s");

If any of you could help me out on this one, that would be awesome [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Share this post


Link to post
Share on other sites
try this
[code]
$result=mysql_query ("SELECT UNIX_TIMESTAMP(mysql_column) as epoch_time FROM table");

$unix_timestamp = mysql_result ($result, 0, 0);
                           echo date("F j, Y @ g:ia", $unix_timestamp);
[/code]

Search in the new snippet section also, they have a really good tutorial on this area. Big ups for the admin for creating the new section.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.