Jump to content

Timestamp Issue


gladiator83x

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\" /]
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.