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
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);
}

?>

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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