Jump to content

[SOLVED] Time Conversion?


DonPatricio

Recommended Posts

I got this date in my DB:

 

2008-02-04 00:12:22

 

I want to output this value - 8 hours. How do i do that. I tried this, but that obviously doesn't work:

$date = mysql_query ("SELECT date from date_test;");

while ($date_output = mysql_fetch_array ($date))
{
$date1 = $date_output[date] - (8*60);
echo $date1 . "<br>";
}


Link to comment
https://forums.phpfreaks.com/topic/89275-solved-time-conversion/
Share on other sites

<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
                   // 7 days; 24 hours; 60 mins; 60secs
echo 'Now:       '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Next Week: '. date('Y-m-d', strtotime('+1 week')) ."\n";
?>

that should be helpful foudn at link below

http://us3.php.net/manual/en/function.time.php

 

Archived

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

×
×
  • 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.