So how would i go about creating a timestamp and converting it into readable time and date.
Please push me in the right direction by reffering me to the function on PHP.net
Thanks
Posted 18 May 2006 - 02:48 PM
Posted 18 May 2006 - 03:02 PM
echo date("M jS Y", $timestamp);
Edited by .Matt, 18 May 2006 - 03:03 PM.
Posted 18 May 2006 - 03:19 PM
Posted 18 May 2006 - 03:30 PM
$timestamp = time(); // at 21:23 this produces: 1147984321
$plusweek = time() +(7 * 24 * 60 * 60);
echo date("M jS Y", $timestamp);
Edited by .Matt, 18 May 2006 - 03:33 PM.
Posted 18 May 2006 - 04:06 PM
Posted 18 May 2006 - 04:29 PM
Quote
<?php
$plusweek = time() + (7 * 24 * 60 * 60);
echo "The current timestamp at ".date('l dS \of F Y h:i:s A')." is: ".time();
echo "<br />The timestamp one week into the future (at ".date('l dS \of F Y h:i:s A', $plusweek)." will be: ".$plusweek."<br /><br /><strong>";
echo time() + 604800 ." </strong>Here we see adding time() and 604800 is the same as the above";
?>
Quote
Edited by .Matt, 18 May 2006 - 04:30 PM.
Posted 19 May 2006 - 01:29 AM
Posted 19 May 2006 - 04:57 PM
Posted 19 May 2006 - 05:15 PM
Posted 22 May 2006 - 04:44 AM
Posted 15 August 2007 - 09:54 AM
Posted 15 August 2007 - 04:48 PM
INSERT INTO `table`(`id`, `time`) VALUES(NULL, FROM_UNIXTIME($timestamp))
SELECT UNIX_TIMESTAMP(`time`) AS timestamp FROM `table`
function formatDate($yy_mm_dd){
$date = explode('-', $yy_mm_dd);
return "{$date[2]}-{$date[1]}-{$date[0]}";
}
function formatDate($yy_mm_dd){
return implode('-', array_reverse(explode('-', $yy_mm_dd)));
}
echo time() + date('Z') + $client_offset;
Edited by Demonslay, 15 August 2007 - 04:57 PM.
Posted 24 August 2007 - 03:48 AM
function format_date($yy_mm_dd){
$getdate = explode(' ', $yy_mm_dd);
$date = explode('-', $getdate[0]);
$date = "{$date[2]}.{$date[1]}.{$date[0]}";
$gettime = explode(':', $getdate[1]);
$time = "{$gettime[0]}:{$gettime[1]}";
$datetime = $date . " " . $time;
$today = date("d.m.Y");
$yesterday = date("d.m.Y", strtotime("-1 day"));
if ($date == $today) {
return "Today".$time."";
}
elseif ($date == $yesterday) {
return "Yesterday".$time."";
}
else {
return $datetime;
}
}
Edited by Marxx, 24 August 2007 - 10:35 AM.
0 members, 1 guests, 0 anonymous users