Jump to content


Photo

Timestamp Issue


  • Please log in to reply
2 replies to this topic

#1 gladiator83x

gladiator83x
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 16 June 2006 - 09:46 PM

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\" /]

#2 tecdesign

tecdesign
  • Members
  • PipPipPip
  • Advanced Member
  • 33 posts

Posted 16 June 2006 - 09:55 PM

try this
$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);

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.

#3 gladiator83x

gladiator83x
  • Members
  • PipPipPip
  • Advanced Member
  • 45 posts

Posted 16 June 2006 - 09:56 PM

Hey Tec_Matt,

I'll give it a shot. Thanks.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users