when i was learning hot wo program in php. I often came across some scripts where in mysql database show the time or date as a bunch of numbers that doesn't looke anything like a date but rather a long number, for example like this: 1151348975 i've seen it on some scripts like phpbb forums and others. If you have phpbb you can see it in _users table there is a field called user_session_time. So i wrote this simple to use and understand tutorial guide with steps on how to learn this function by samples.

I was breaking my head on how to figure out what date was this.??
well it turns out that this information was inserted into mysql table database using PHP time() function. When you display the time() function, it will display a long number. try this sample:

CODE:
<php
echo time();
?>

If you run this short script, it will display something like this:
CODE:
1151348975
* NOTE: when you run the script it will show a different number than my example here because its abviously a different time

From what i've learn about this handy function it some number in seconds. I haven't figure out much more than that.

But i wrote a little script that that show you how you can find out how much time as past in years, months, weeks, days, hours and seconds from a time stamp.
CODE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Seach Time Stamp Script By Wallpaperama.com</title>
</head>
<body>
  <div align="center">
    <h1>SEARCH TIME STAMP by <a href="http://www.wallpaperama.com">Wallpaperama.com</a></h1>
  </div>
<?
function search($session_time)
{
//$session_time ="1151348975";

echo"You Entered: $session_time <BR>";
echo"The Current Time is = ".time()."<BR>";
$time_difference =  time() - $session_time ;
echo"time_difference = ".$time_difference."<HR>";
$seconds = $time_difference ;
$minutes = round($time_difference / 60 );
$hours = round($time_difference / 3600 );
$days = round($time_difference / 86400 );
$weeks = round($time_difference / 604800 );
$months = round($time_difference / 2419200 );
$years = round($time_difference / 29030400 );
echo"seconds: $seconds<br>";
echo"minutes: $minutes<br>";
echo"hours: $hours<br>";
echo"days: $days<br>";
echo"weeks: $weeks<br>";
echo"months: $months<br>";
echo"years: $years<br>";
}

if($_POST['session_time'])
{
echo search($_POST['session_time']);
echo'<div align="center"><p><a href="'.$_SERVER['REQUEST_URI'].'">Click Here To Search Again</a></p></div>';
}

else
{
?>
<div align="center">
<form name="form1" method="post" action="">

    <p>Seach:
      <input name="session_time" type="text" size="35"><br>
      <em>example:
1151348975
    </em></p>
    <p>
      <input type="submit" name="Search" value="Search">
</p>

</form>
</div>
<?

}
?>
<p>&nbsp;</p>
<p align="center">This script was created from support from <a href="http://www.webune.com">Webune.com</a> Web Hosting. </p>
</body>
</html>


To see this script in action, open your text editor, if you are using windows, you can use notepad, copy and paste this code into notepad and save it as session_time.php and upload to a site that has PHP. IF YOU DON"T HAVE A PHP SITE, VISIT OUR FRIENDS AT WWW.WEBUNE.COM AND SIGN UP WITH ONE OF THEIR PHP WEB HOSTING PLANS.

Once you have uploaded the session_time.php to your website, open it with your browser and you will get a search bar, enter the time stamp and it will tell you how many secons minutes hours days weeks months and years have passed.

NOTE: this is a very basic script, its only purpose is to show you how you can use the time() PHP function on your script to insert data into your mysql database using the time() function on your PHP scripts.

Hope this helps. If anyone has any other useful information about this, please provide by replying to this post. thanks.

you can visit http://www.php.net/manual/en/function.time.php for more info on this function