Jump to content

Time Questions, Yaaayyy


Zepo.

Recommended Posts

Ok i have this code. The first if works fine, but the second one generates some crazy large number, and i dont know why. Both of the incoming dates / time are the same format.. so i dont know why it would do that.

 

if($mem[edited] == 000000000000){
$upjoin="Not Updated Yet";
$_joined = strtotime($joined);
$time = time();
$diff = $time - $_joined;
$diff = $diff - '60';
$joined = date("F j, Y", $_joined);
}else{
$upjoin="$edited";
$_edited = strtotime($edited);
$time = time();
$diff = $time - $_edited;
$diff = $diff - '60';
$edited = date("F j, Y", $_edited);
}

Link to comment
https://forums.phpfreaks.com/topic/78501-time-questions-yaaayyy/
Share on other sites

I'm not sure what you're trying to do. But one thing wrong is putting 60 in quotes. If you're trying to subtract a minute (60 seconds), then don't put it in quotes.

 

Example:

<?php
// set $joined
// set $edited

$time = time();

if (0 == $mem['edited']) {
    $upjoin = 'Not Updated Yet';
    $_joined = strtotime($joined);
    $diff = $time - $_joined;
    $diff = $diff - 60;
    $joined = date('F j, Y', $_joined);
} else {
    $upjoin = $edited;
    $_edited = strtotime($edited);
    $diff = $time - $_edited;
    $diff = $diff - 60;
    $edited = date('F j, Y', $_edited);
}

?>

 

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.